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://github.com/bluss/either/workflows/CI/badge.svg?branch=master 20.. _build_status: https://github.com/bluss/either/actions 21 22.. |crates| image:: https://img.shields.io/crates/v/either.svg 23.. _crates: https://crates.io/crates/either 24 25How to use with cargo:: 26 27 [dependencies] 28 either = "1.8" 29 30 31Recent Changes 32-------------- 33 34- 1.8.1 35 36 - Clarified that the multiple licenses are combined with OR. 37 38- 1.8.0 39 40 - **MSRV**: ``either`` now requires Rust 1.36 or later. 41 42 - Add new methods ``.as_pin_ref()`` and ``.as_pin_mut()`` to project a 43 pinned ``Either`` as inner ``Pin`` variants, by @cuviper (#77) 44 45 - Implement the ``Future`` trait, by @cuviper (#77) 46 47 - Specialize more methods of the ``io`` traits, by @Kixunil and @cuviper (#75) 48 49- 1.7.0 50 51 - **MSRV**: ``either`` now requires Rust 1.31 or later. 52 53 - Export the macro ``for_both!``, by @thomaseizinger (#58) 54 55 - Implement the ``io::Seek`` trait, by @Kerollmops (#60) 56 57 - Add new method ``.either_into()`` for ``Into`` conversion, by @TonalidadeHidrica (#63) 58 59 - Add new methods ``.factor_ok()``, ``.factor_err()``, and ``.factor_none()``, 60 by @zachs18 (#67) 61 62 - Specialize ``source`` in the ``Error`` implementation, by @thomaseizinger (#69) 63 64 - Specialize more iterator methods and implement the ``FusedIterator`` trait, 65 by @Ten0 (#66) and @cuviper (#71) 66 67 - Specialize ``Clone::clone_from``, by @cuviper (#72) 68 69- 1.6.1 70 71 - Add new methods ``.expect_left()``, ``.unwrap_left()``, 72 and equivalents on the right, by @spenserblack (#51) 73 74- 1.6.0 75 76 - Add new modules ``serde_untagged`` and ``serde_untagged_optional`` to customize 77 how ``Either`` fields are serialized in other types, by @MikailBag (#49) 78 79- 1.5.3 80 81 - Add new method ``.map()`` for ``Either<T, T>`` by @nvzqz (#40). 82 83- 1.5.2 84 85 - Add new methods ``.left_or()``, ``.left_or_default()``, ``.left_or_else()``, 86 and equivalents on the right, by @DCjanus (#36) 87 88- 1.5.1 89 90 - Add ``AsRef`` and ``AsMut`` implementations for common unsized types: 91 ``str``, ``[T]``, ``CStr``, ``OsStr``, and ``Path``, by @mexus (#29) 92 93- 1.5.0 94 95 - Add new methods ``.factor_first()``, ``.factor_second()`` and ``.into_inner()`` 96 by @mathstuf (#19) 97 98- 1.4.0 99 100 - Add inherent method ``.into_iter()`` by @cuviper (#12) 101 102- 1.3.0 103 104 - Add opt-in serde support by @hcpl 105 106- 1.2.0 107 108 - Add method ``.either_with()`` by @Twey (#13) 109 110- 1.1.0 111 112 - Add methods ``left_and_then``, ``right_and_then`` by @rampantmonkey 113 - Include license files in the repository and released crate 114 115- 1.0.3 116 117 - Add crate categories 118 119- 1.0.2 120 121 - Forward more ``Iterator`` methods 122 - Implement ``Extend`` for ``Either<L, R>`` if ``L, R`` do. 123 124- 1.0.1 125 126 - Fix ``Iterator`` impl for ``Either`` to forward ``.fold()``. 127 128- 1.0.0 129 130 - Add default crate feature ``use_std`` so that you can opt out of linking to 131 std. 132 133- 0.1.7 134 135 - Add methods ``.map_left()``, ``.map_right()`` and ``.either()``. 136 - Add more documentation 137 138- 0.1.3 139 140 - Implement Display, Error 141 142- 0.1.2 143 144 - Add macros ``try_left!`` and ``try_right!``. 145 146- 0.1.1 147 148 - Implement Deref, DerefMut 149 150- 0.1.0 151 152 - Initial release 153 - Support Iterator, Read, Write 154 155License 156------- 157 158Dual-licensed to be compatible with the Rust project. 159 160Licensed under the Apache License, Version 2.0 161https://www.apache.org/licenses/LICENSE-2.0 or the MIT license 162https://opensource.org/licenses/MIT, at your 163option. This file may not be copied, modified, or distributed 164except according to those terms. 165