#data-structure #no_std

either

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

17 releases (9 stable)

1.5.0 Mar 25, 2018
1.4.0 Nov 14, 2017
1.3.0 Oct 15, 2017
1.1.0 Mar 25, 2017
0.1.3 Sep 25, 2015

#4 in Data structures

Download history 20758/week @ 2018-05-06 25891/week @ 2018-05-13 23956/week @ 2018-05-20 21959/week @ 2018-05-27 24032/week @ 2018-06-03 25150/week @ 2018-06-10 21737/week @ 2018-06-17 22815/week @ 2018-06-24 24812/week @ 2018-07-01 23561/week @ 2018-07-08 26534/week @ 2018-07-15 26056/week @ 2018-07-22 21470/week @ 2018-07-29

95,284 downloads per month

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

MIT/Apache-2.0 license

Dependencies

  • optional serde 1.0+derive

Reverse deps