bluss/either

The enum Either with variants Left and Right is a general purpose sum type with two cases.

558

stars

310

commits

Rust

primary language

Aug 20, 2026

updated

docs.rs/either/
rust
Browse cluster: Rust Numerical Computing

README

Either

Either crate Either documentation minimum rustc 1.63 build status

The enum Either with variants Left and Right is a general purpose sum type with two cases.

Either has methods that are similar to Option and Result, and it also implements traits like Iterator, Read, and Write.

The crate includes macros try_left!() and try_right!() to use for short-circuiting logic, similar to how the ? operator is used with Result. Note that Either is general purpose and unopinionated about the meaning of Left and Right. For describing success or error, use the regular Result.

Please read the API documentation here, and see RELEASES.md for the version history.

How to use with cargo:

[dependencies]
either = "1"

License

Dual-licensed to be compatible with the Rust project.

Licensed under the Apache License, Version 2.0 https://www.apache.org/licenses/LICENSE-2.0 or the MIT license https://opensource.org/licenses/MIT, at your option. This file may not be copied, modified, or distributed except according to those terms.

Contributors

(top 30 of 42)

cuviper

145 commits

bluss

61 commits

m4rw3r

8 commits

yotamofek

8 commits

bluss/either

The enum Either with variants Left and Right is a general purpose sum type with two cases.

558

stars

310

commits

Rust

primary language

Aug 20, 2026

updated

docs.rs/either/
rust
Browse cluster: Rust Numerical Computing

README

Either

Either crate Either documentation minimum rustc 1.63 build status

The enum Either with variants Left and Right is a general purpose sum type with two cases.

Either has methods that are similar to Option and Result, and it also implements traits like Iterator, Read, and Write.

The crate includes macros try_left!() and try_right!() to use for short-circuiting logic, similar to how the ? operator is used with Result. Note that Either is general purpose and unopinionated about the meaning of Left and Right. For describing success or error, use the regular Result.

Please read the API documentation here, and see RELEASES.md for the version history.

How to use with cargo:

[dependencies]
either = "1"

License

Dual-licensed to be compatible with the Rust project.

Licensed under the Apache License, Version 2.0 https://www.apache.org/licenses/LICENSE-2.0 or the MIT license https://opensource.org/licenses/MIT, at your option. This file may not be copied, modified, or distributed except according to those terms.

Contributors

(top 30 of 42)

cuviper

145 commits

bluss

61 commits

m4rw3r

8 commits

yotamofek

8 commits

Languages

Rust

100.0%