• Home
Name Date Size #Lines LOC

..--

.github/workflows/06-Sep-2024-7157

src/06-Sep-2024-1,676898

.cargo_vcs_info.jsonD06-Sep-202474 65

.gitignoreD06-Sep-202420 32

Android.bpD06-Sep-20242.4 KiB8176

Cargo.tomlD06-Sep-20241.2 KiB4137

Cargo.toml.origD06-Sep-2024756 3627

LICENSED06-Sep-202410.6 KiB202169

LICENSE-APACHED06-Sep-202410.6 KiB202169

LICENSE-MITD06-Sep-20241 KiB2622

METADATAD06-Sep-2024654 2119

MODULE_LICENSE_APACHE2D06-Sep-20240

OWNERSD06-Sep-202440 21

README-crates.io.mdD06-Sep-2024441 118

README.rstD06-Sep-20243.9 KiB16996

TEST_MAPPINGD06-Sep-2024885 4645

cargo_embargo.jsonD06-Sep-202442 54

README-crates.io.md

1The enum `Either` with variants `Left` and `Right` is a general purpose
2sum type with two cases.
3
4Either has methods that are similar to Option and Result, and it also implements
5traits like `Iterator`.
6
7Includes macros `try_left!()` and `try_right!()` to use for
8short-circuiting logic, similar to how the `?` operator is used with `Result`.
9Note that `Either` is general purpose. For describing success or error, use the
10regular `Result`.
11

README.rst

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