| 1 |
# Either |
| 2 |
|
| 3 |
[](https://crates.io/crates/either) |
| 4 |
[](https://docs.rs/either) |
| 5 |
 |
| 6 |
[](https://github.com/rayon-rs/either/actions) |
| 7 |
|
| 8 |
The enum `Either` with variants `Left` and `Right` is a general purpose sum |
| 9 |
type with two cases. |
| 10 |
|
| 11 |
`Either` has methods that are similar to `Option` and `Result`, and it also |
| 12 |
implements traits like `Iterator`, `Read`, and `Write`. |
| 13 |
|
| 14 |
The crate includes macros `try_left!()` and `try_right!()` to use for |
| 15 |
short-circuiting logic, similar to how the `?` operator is used with `Result`. |
| 16 |
Note that `Either` is general purpose and unopinionated about the meaning of |
| 17 |
`Left` and `Right`. For describing success or error, use the regular `Result`. |
| 18 |
|
| 19 |
Please read the [API documentation here](https://docs.rs/either/), and see |
| 20 |
[RELEASES.md](RELEASES.md) for the version history. |
| 21 |
|
| 22 |
How to use with cargo: |
| 23 |
|
| 24 |
```toml |
| 25 |
[dependencies] |
| 26 |
either = "1" |
| 27 |
``` |
| 28 |
|
| 29 |
## License |
| 30 |
|
| 31 |
Dual-licensed to be compatible with the Rust project. |
| 32 |
|
| 33 |
Licensed under the Apache License, Version 2.0 |
| 34 |
<https://www.apache.org/licenses/LICENSE-2.0> or the MIT license |
| 35 |
<https://opensource.org/licenses/MIT>, at your option. This file may not |
| 36 |
be copied, modified, or distributed except according to those terms. |