Crate quither

Source
Expand description

“Quad-state Either”: Quither. In other words, either-or-neither-or-both type.

Quither is a type that represents four states:

  • Left(L)
  • Right(R)
  • Both(L, R)
  • Neither

This crate also provides an arbitrary combination types of Either, Neither, and Both. For example, EitherOrBoth<L, R> is a type that represents either a left (Left(L)) or right (Right(R)) or both (Both(L, R)). These types have consistent APIs (as much as possible ☺) so that you can use them interchangeably.

Each combination types implements the common methods greedily, even if it’s not very useful for that type itself. For example, EitherOrNeither type implements is_both() method, even if it always returns false.

Re-exports§

pub use result::ResultExt;

Modules§

iter
result

Enums§

Both
An enum that represents a pair of values (Both(L, R)).
Either
An enum that represents either a left (Left(L)) or right (Right(R)) value.
EitherOrBoth
An enum that represents either a left (Left(L)) or right (Right(R)) or both (Both(L, R)).
EitherOrNeither
An enum that represents either a left (Left(L)) or right (Right(R)) or neither (Neither).
Neither
An enum that represents a single Neither value.
NeitherOrBoth
An enum that represents a single Neither value or a pair of values (Both(L, R)).
Quither
An enum that represents either an empty value, left value, right value, or both values.