/
Depends on
- dh-cargo (dh-sequence-cargo)
- cargo, debhelper-compat, librust-serde-1+alloc-dev, librust-serde-1+derive-dev, libstd-rust-dev, rustc
Used by
- rust-flexi-logger 0.29.8-4
- rust-itertools 0.14.0-2
- rust-neli-proc-macros 0.2.1-1
- rust-nonempty-collections 1.3.0+dfsg-1
- rust-pyo3 0.28.2-2
- rust-rayon 1.12.0-1
- rust-rayon-cond 0.4.0-2
- rust-schemars-0.8 0.8.22-3
- rust-schemars 1.2.2-2
- rust-sqlx-macros-core 0.8.3-3
- rust-sqlx-core 0.8.3-3
- rust-sqlx-mysql 0.8.3-1
- rust-tokio-socks 0.5.3-1
- rust-writeable 0.6.3-1
- rust-zerocopy 0.8.26-4
- jujutsu 0.44.0-8
README (full)
Either
The enum Either with variants Left and Right and trait implementations including Iterator, Read, Write.
Either has methods that are similar to Option and Result.
Includes convenience macros try_left!() and try_right!() to use for short-circuiting logic.
Please read the API documentation here_
_ |crates|
How to use with cargo::
[dependencies] either = "1"
Recent Changes
-
1.17.0
Add implementations for all
std::fmttraits, by @msrd0 (#141)
-
1.16.0
-
Add many new methods dealing with each side, by @A4-Tacks:
inspect_leftandinspect_right(#124)left_andandright_and(#125)is_left_andandis_right_and(#126)map_left_orandmap_right_or(#127)
Add a version of
for_both!with a singleident, by @A4-Tacks (#128)Add a
map_both!macro, by @JohnScience (#109) and @ronnodas (#137)
-
-
1.15.0
Fix
serdesupport when building withoutstd, by @klkvr (#119)-
Use a more common
stdfeature for default enablement, deprecatingthe
use_stdfeature as a mere alias of the new name.
-
1.14.0
MSRV:
eithernow requires Rust 1.63 or later.Implement
fmt::WriteforEither, by @yotamofek (#113)Replace
Into<Result> for EitherwithFrom<Either> for Result, by @cuviper (#118)
-
1.13.0
Add new methods
.cloned()and.copied(), by @ColonelThirtyTwo (#107)
-
1.12.0
MSRV:
eithernow requires Rust 1.37 or later.Specialize
nth_backforEitherandIterEither, by @cuviper (#106)
-
1.11.0
-
Add new trait
IntoEitherthat is useful to convert toEitherin method chains,by @SFM61319 (#101)
-
-
1.10.0
-
Add new methods
.factor_iter(),.factor_iter_mut(), and.factor_into_iter()that return
Eitheritems, plus.iter()and.iter_mut()to convert to direct reference iterators; by @aj-bagwell and @cuviper (#91)
-
-
1.9.0
Add new methods
.map_either()and.map_either_with(), by @nasadorian (#82)
-
1.8.1
Clarified that the multiple licenses are combined with OR.
-
1.8.0
MSRV:
eithernow requires Rust 1.36 or later.-
Add new methods
.as_pin_ref()and.as_pin_mut()to project apinned
Eitheras innerPinvariants, by @cuviper (#77) Implement the
Futuretrait, by @cuviper (#77)Specialize more methods of the
iotraits, by @Kixunil and @cuviper (#75)
-
1.7.0
MSRV:
eithernow requires Rust 1.31 or later.Export the macro
for_both!, by @thomaseizinger (#58)Implement the
io::Seektrait, by @Kerollmops (#60)Add new method
.either_into()forIntoconversion, by @TonalidadeHidrica (#63)-
Add new methods
.factor_ok(),.factor_err(), and.factor_none(),by @zachs18 (#67)
Specialize
sourcein theErrorimplementation, by @thomaseizinger (#69)-
Specialize more iterator methods and implement the
FusedIteratortrait,by @Ten0 (#66) and @cuviper (#71)
Specialize
Clone::clone_from, by @cuviper (#72)
-
1.6.1
-
Add new methods
.expect_left(),.unwrap_left(),and equivalents on the right, by @spenserblack (#51)
-
-
1.6.0
-
Add new modules
serde_untaggedandserde_untagged_optionalto customizehow
Eitherfields are serialized in other types, by @MikailBag (#49)
-
-
1.5.3
Add new method
.map()forEither<T, T>by @nvzqz (#40).
-
1.5.2
-
Add new methods
.left_or(),.left_or_default(),.left_or_else(),and equivalents on the right, by @DCjanus (#36)
-
-
1.5.1
-
Add
AsRefandAsMutimplementations for common unsized types:str,[T],CStr,OsStr, andPath, by @mexus (#29)
-
-
1.5.0
-
Add new methods
.factor_first(),.factor_second()and.into_inner()by @mathstuf (#19)
-
-
1.4.0
Add inherent method
.into_iter()by @cuviper (#12)
-
1.3.0
Add opt-in serde support by @hcpl
-
1.2.0
Add method
.either_with()by @Twey (#13)
-
1.1.0
Add methods
left_and_then,right_and_thenby @rampantmonkeyInclude license files in the repository and released crate
-
1.0.3
Add crate categories
-
1.0.2
Forward more
IteratormethodsImplement
ExtendforEither<L, R>ifL, Rdo.
-
1.0.1
Fix
Iteratorimpl forEitherto forward.fold().
-
1.0.0
-
Add default crate feature
use_stdso that you can opt out of linking tostd.
-
-
0.1.7
Add methods
.map_left(),.map_right()and.either().Add more documentation
-
0.1.3
Implement Display, Error
-
0.1.2
Add macros
try_left!andtry_right!.
-
0.1.1
Implement Deref, DerefMut
-
0.1.0
Initial release
Support Iterator, Read, Write
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.
| dir | .github/ |
| dir | debian/ |
| dir | src/ |
| file | .cargo_vcs_info.json |
| file | .gitignore |
| file | Cargo.lock |
| file | Cargo.toml |
| file | Cargo.toml.orig |
| file | LICENSE-APACHE |
| file | LICENSE-MIT |
| file | README-crates.io.md |
| file | README.rst |