srijs/either
The enum Either with variants Left and Right is a general purpose sum type with two cases.
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__
|build_status|_ |crates|_
.. |build_status| image:: https://travis-ci.org/bluss/either.svg?branch=master
.. _build_status: https://travis-ci.org/bluss/either
.. |crates| image:: http://meritbadge.herokuapp.com/either
.. _crates: https://crates.io/crates/either
How to use with cargo::
[dependencies]
either = "1.3"
Recent Changes
-
1.3.0
- Add opt-in serde support by @hcpl
-
1.2.0
- Add method
.either_with()by @Twey (rayon-rs#13)
- Add method
-
1.1.0
- Add methods
left_and_then,right_and_thenby @rampantmonkey - Include license files in the repository and released crate
- Add methods
-
1.0.3
- Add crate categories
-
1.0.2
- Forward more
Iteratormethods - Implement
ExtendforEither<L, R>ifL, Rdo.
- Forward more
-
1.0.1
- Fix
Iteratorimpl forEitherto forward.fold().
- Fix
-
1.0.0
- Add default crate feature
use_stdso that you can opt out of linking to
std.
- Add default crate feature
-
0.1.7
- Add methods
.map_left(),.map_right()and.either(). - Add more documentation
- Add methods
-
0.1.3
- Implement Display, Error
-
0.1.2
- Add macros
try_left!andtry_right!.
- Add macros
-
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
http://www.apache.org/licenses/LICENSE-2.0 or the MIT license
http://opensource.org/licenses/MIT, at your
option. This file may not be copied, modified, or distributed
except according to those terms.