5 The enum ``Either`` with variants ``Left`` and ``Right`` and trait
6 implementations including Iterator, Read, Write.
8 Either has methods that are similar to Option and Result.
10 Includes convenience macros ``try_left!()`` and ``try_right!()`` to use for
11 short-circuiting logic.
13 Please read the `API documentation here`__
15 __ https://docs.rs/either/
17 |build_status|_ |crates|_
19 .. |build_status| image:: https://github.com/bluss/either/workflows/CI/badge.svg?branch=master
20 .. _build_status: https://github.com/bluss/either/actions
22 .. |crates| image:: https://img.shields.io/crates/v/either.svg
23 .. _crates: https://crates.io/crates/either
25 How to use with cargo::
36 - **MSRV**: ``either`` now requires Rust 1.36 or later.
38 - Add new methods ``.as_pin_ref()`` and ``.as_pin_mut()`` to project a
39 pinned ``Either`` as inner ``Pin`` variants, by @cuviper (#77)
41 - Implement the ``Future`` trait, by @cuviper (#77)
43 - Specialize more methods of the ``io`` traits, by @Kixunil and @cuviper (#75)
47 - **MSRV**: ``either`` now requires Rust 1.31 or later.
49 - Export the macro ``for_both!``, by @thomaseizinger (#58)
51 - Implement the ``io::Seek`` trait, by @Kerollmops (#60)
53 - Add new method ``.either_into()`` for ``Into`` conversion, by @TonalidadeHidrica (#63)
55 - Add new methods ``.factor_ok()``, ``.factor_err()``, and ``.factor_none()``,
58 - Specialize ``source`` in the ``Error`` implementation, by @thomaseizinger (#69)
60 - Specialize more iterator methods and implement the ``FusedIterator`` trait,
61 by @Ten0 (#66) and @cuviper (#71)
63 - Specialize ``Clone::clone_from``, by @cuviper (#72)
67 - Add new methods ``.expect_left()``, ``.unwrap_left()``,
68 and equivalents on the right, by @spenserblack (#51)
72 - Add new modules ``serde_untagged`` and ``serde_untagged_optional`` to customize
73 how ``Either`` fields are serialized in other types, by @MikailBag (#49)
77 - Add new method ``.map()`` for ``Either<T, T>`` by @nvzqz (#40).
81 - Add new methods ``.left_or()``, ``.left_or_default()``, ``.left_or_else()``,
82 and equivalents on the right, by @DCjanus (#36)
86 - Add ``AsRef`` and ``AsMut`` implementations for common unsized types:
87 ``str``, ``[T]``, ``CStr``, ``OsStr``, and ``Path``, by @mexus (#29)
91 - Add new methods ``.factor_first()``, ``.factor_second()`` and ``.into_inner()``
96 - Add inherent method ``.into_iter()`` by @cuviper (#12)
100 - Add opt-in serde support by @hcpl
104 - Add method ``.either_with()`` by @Twey (#13)
108 - Add methods ``left_and_then``, ``right_and_then`` by @rampantmonkey
109 - Include license files in the repository and released crate
113 - Add crate categories
117 - Forward more ``Iterator`` methods
118 - Implement ``Extend`` for ``Either<L, R>`` if ``L, R`` do.
122 - Fix ``Iterator`` impl for ``Either`` to forward ``.fold()``.
126 - Add default crate feature ``use_std`` so that you can opt out of linking to
131 - Add methods ``.map_left()``, ``.map_right()`` and ``.either()``.
132 - Add more documentation
136 - Implement Display, Error
140 - Add macros ``try_left!`` and ``try_right!``.
144 - Implement Deref, DerefMut
149 - Support Iterator, Read, Write
154 Dual-licensed to be compatible with the Rust project.
156 Licensed under the Apache License, Version 2.0
157 https://www.apache.org/licenses/LICENSE-2.0 or the MIT license
158 https://opensource.org/licenses/MIT, at your
159 option. This file may not be copied, modified, or distributed
160 except according to those terms.