1 2Either 3====== 4 5The enum ``Either`` with variants ``Left`` and ``Right`` and trait 6implementations including Iterator, Read, Write. 7 8Either has methods that are similar to Option and Result. 9 10Includes convenience macros ``try_left!()`` and ``try_right!()`` to use for 11short-circuiting logic. 12 13Please read the `API documentation here`__ 14 15__ https://docs.rs/either/ 16 17|build_status|_ |crates|_ 18 19.. |build_status| image:: https://travis-ci.org/bluss/either.svg?branch=master 20.. _build_status: https://travis-ci.org/bluss/either 21 22.. |crates| image:: http://meritbadge.herokuapp.com/either 23.. _crates: https://crates.io/crates/either 24 25How to use with cargo:: 26 27 [dependencies] 28 either = "1.6" 29 30 31Recent Changes 32-------------- 33 34- 1.6.1 35 36 - Add new methods ``.expect_left()``, ``.unwrap_left()``, 37 and equivalents on the right, by @spenserblack (#51) 38 39- 1.6.0 40 41 - Add new modules ``serde_untagged`` and ``serde_untagged_optional`` to customize 42 how ``Either`` fields are serialized in other types, by @MikailBag (#49) 43 44- 1.5.3 45 46 - Add new method ``.map()`` for ``Either<T, T>`` by @nvzqz (#40). 47 48- 1.5.2 49 50 - Add new methods ``.left_or()``, ``.left_or_default()``, ``.left_or_else()``, 51 and equivalents on the right, by @DCjanus (#36) 52 53- 1.5.1 54 55 - Add ``AsRef`` and ``AsMut`` implementations for common unsized types: 56 ``str``, ``[T]``, ``CStr``, ``OsStr``, and ``Path``, by @mexus (#29) 57 58- 1.5.0 59 60 - Add new methods ``.factor_first()``, ``.factor_second()`` and ``.into_inner()`` 61 by @mathstuf (#19) 62 63- 1.4.0 64 65 - Add inherent method ``.into_iter()`` by @cuviper (#12) 66 67- 1.3.0 68 69 - Add opt-in serde support by @hcpl 70 71- 1.2.0 72 73 - Add method ``.either_with()`` by @Twey (#13) 74 75- 1.1.0 76 77 - Add methods ``left_and_then``, ``right_and_then`` by @rampantmonkey 78 - Include license files in the repository and released crate 79 80- 1.0.3 81 82 - Add crate categories 83 84- 1.0.2 85 86 - Forward more ``Iterator`` methods 87 - Implement ``Extend`` for ``Either<L, R>`` if ``L, R`` do. 88 89- 1.0.1 90 91 - Fix ``Iterator`` impl for ``Either`` to forward ``.fold()``. 92 93- 1.0.0 94 95 - Add default crate feature ``use_std`` so that you can opt out of linking to 96 std. 97 98- 0.1.7 99 100 - Add methods ``.map_left()``, ``.map_right()`` and ``.either()``. 101 - Add more documentation 102 103- 0.1.3 104 105 - Implement Display, Error 106 107- 0.1.2 108 109 - Add macros ``try_left!`` and ``try_right!``. 110 111- 0.1.1 112 113 - Implement Deref, DerefMut 114 115- 0.1.0 116 117 - Initial release 118 - Support Iterator, Read, Write 119 120License 121------- 122 123Dual-licensed to be compatible with the Rust project. 124 125Licensed under the Apache License, Version 2.0 126http://www.apache.org/licenses/LICENSE-2.0 or the MIT license 127http://opensource.org/licenses/MIT, at your 128option. This file may not be copied, modified, or distributed 129except according to those terms. 130