#data-structure #no_std

no-std either

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

20 releases (12 stable)

1.5.3 Sep 13, 2019
1.5.2 Apr 2, 2019
1.5.1 Feb 21, 2019
1.5.0 Mar 25, 2018
0.1.3 Sep 25, 2015

#5 in Data structures

Download history 108404/week @ 2019-05-31 97423/week @ 2019-06-07 87640/week @ 2019-06-14 90222/week @ 2019-06-21 82246/week @ 2019-06-28 77302/week @ 2019-07-05 80429/week @ 2019-07-12 84332/week @ 2019-07-19 86389/week @ 2019-07-26 89818/week @ 2019-08-02 93945/week @ 2019-08-09 91192/week @ 2019-08-16 91395/week @ 2019-08-23 92815/week @ 2019-08-30 101419/week @ 2019-09-06

379,260 downloads per month
Used in 3,179 crates (148 directly)

MIT/Apache

29KB
530 lines

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.

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. For describing success or error, use the regular Result.


lib.rs:

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

Crate features:

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

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

Dependencies