Enum choice::Choice[][src]

pub enum Choice<L, 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.



The "left" case.


The "right" case.


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

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

impl<A, B> Display for Choice<A, B> where
    A: Display,
    B: Display

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

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

impl<L, R> Send for Choice<L, R> where
    L: Send,
    R: Send

impl<L, R> Sync for Choice<L, R> where
    L: Sync,
    R: Sync

impl<L, R> Unpin for Choice<L, R> where
    L: Unpin,
    R: Unpin

impl<L, R> UnwindSafe for Choice<L, R> where
    L: UnwindSafe,
    R: UnwindSafe

Blanket Implementations

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

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> BorrowMut<T> for T where
    T: ?Sized

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

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

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T> ToOwned for T where
    T: Clone

type Owned = T

The resulting type after obtaining ownership.

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

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

The type returned in the event of a conversion error.