Crate either

Source
Expand description

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

Crate features:

  • "std" Enabled by default. Disable to make the library #![no_std].

  • "serde" Disabled by default. Enable to #[derive(Serialize, Deserialize)] for Either

Re-exportsยง

pub use crate::Either::Left;
pub use crate::Either::Right;

Modulesยง

into_either ๐Ÿ”’
The trait IntoEither provides methods for converting a type Self, whose size is constant and known at compile-time, into an Either variant.
iterator ๐Ÿ”’

Macrosยง

check_t ๐Ÿ”’
A helper macro to check if AsRef and AsMut are implemented for a given type.
for_both
Evaluate the provided expression for both Either::Left and Either::Right.
impl_specific_ref_and_mut ๐Ÿ”’
map_either ๐Ÿ”’
try_left
Macro for unwrapping the left side of an Either, which fails early with the opposite side. Can only be used in functions that return Either because of the early return of Right that it provides.
try_right
Dual to try_left!, see its documentation for more information.

Structsยง

IterEither
Iterator that maps left or right iterators to corresponding Either-wrapped items.

Enumsยง

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

Traitsยง

IntoEither
Provides methods for converting a type Self into either a Left or Right variant of Either<Self, Self>.

Functionsยง

_unsized_ref_propagation ๐Ÿ”’
_unsized_std_propagation ๐Ÿ”’