Enum choice::Choice[][src]

pub enum Choice<L, R> {
    L(L),
    R(R),
}

Represents a choice between two types, which you can compose to represent a choice between more types -- Choice<C, Choice<A, B>> for instance.

See the top-level crate docs for more details.

Variants

L(L)

The "left" case.

R(R)

The "right" case.

Implementations

impl<A, B> Choice<A, B>[src]

pub fn new(choice: A) -> Self[src]

Constructs a Choice between two types, where the "decision" is of the first type.

pub fn or<L>(self) -> Choice<L, Choice<A, B>>[src]

Wraps an existing Choice with an additional chooseable type.

impl<A> Choice<A, Never>[src]

pub fn get(&self) -> &A[src]

Returns the "left" value, as the right value is provably uninhabited.

Trait Implementations

impl<L: Clone, R: Clone> Clone for Choice<L, R>[src]

impl<L: Copy, R: Copy> Copy for Choice<L, R>[src]

impl<A, B> Debug for Choice<A, B> where
    A: Debug,
    B: Debug
[src]

impl<'de, L, R> Deserialize<'de> for Choice<L, R> where
    L: Deserialize<'de>,
    R: Deserialize<'de>, 
[src]

impl<A, B> Display for Choice<A, B> where
    A: Display,
    B: Display
[src]

impl<L: Eq, R: Eq> Eq for Choice<L, R>[src]

impl<L: Hash, R: Hash> Hash for Choice<L, R>[src]

impl<L: Ord, R: Ord> Ord for Choice<L, R>[src]

impl<L: PartialEq, R: PartialEq> PartialEq<Choice<L, R>> for Choice<L, R>[src]

impl<L: PartialOrd, R: PartialOrd> PartialOrd<Choice<L, R>> for Choice<L, R>[src]

impl<L, R> Serialize for Choice<L, R> where
    L: Serialize,
    R: Serialize
[src]

impl<L, R> StructuralEq for Choice<L, R>[src]

impl<L, R> StructuralPartialEq for Choice<L, R>[src]

Auto Trait Implementations

impl<L, R> RefUnwindSafe for Choice<L, R> where
    L: RefUnwindSafe,
    R: RefUnwindSafe
[src]

impl<L, R> Send for Choice<L, R> where
    L: Send,
    R: Send
[src]

impl<L, R> Sync for Choice<L, R> where
    L: Sync,
    R: Sync
[src]

impl<L, R> Unpin for Choice<L, R> where
    L: Unpin,
    R: Unpin
[src]

impl<L, R> UnwindSafe for Choice<L, R> where
    L: UnwindSafe,
    R: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.