pub enum Orwith<T> {
Neither,
With(T, T),
Or(T),
}
Expand description
Represents one, another, or two values. (Addtionally, as an edgecase, the enum contains a Neither value.)
use orwith::Orwith;
let x:Option<&str> = Some("Hello!");
let y:Option<&str> = Some("Goodbye!");
let v = Orwith::orwith(x, y);
Neither option was chosen or both options were refused.
Both options were preferred.
Only one option was preferred or the option not chosen was refused.
Takes two options and decides which variant to choose based on the presence of values.
Returns a mutable reference to the first value.
Returns a mutable reference to the last value.
Returns the first item and consumes this Orwith value.
Returns the last item and consumes this Orwith value.
Returns the first and last items and consumes this Orwith value.
Returns an immutable reference to the first value.
Returns an immutable reference to the last value.
Formats the value using the given formatter.
Read more
Returns the “default value” for a type.
Read more
Converts to this type from the input type.
Converts this type into the (usually inferred) input type.
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self).
That is, this conversion is whatever the implementation of
From<T> for U chooses to do.
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.