[][src]Struct dialectic::Branches

#[must_use]pub struct Branches<Tx, Rx, Choices, E = ()> where
    Choices: Tuple,
    Choices::AsList: EachActionable<E>,
    E: Environment,
    E::Dual: Environment
{ /* fields omitted */ }

The result of offer, Branches<Tx, Rx, Ps> represents an enumeration of the possible new channel states that could result from the offering of the type-level list of protocols Ps.

To find out which protocol was selected by the other party, use Branches::case, or better yet, use the offer! macro to ensure you don't miss any cases.

Implementations

impl<'a, Tx, Rx, Choices, P, Ps, E> Branches<Tx, Rx, Choices, E> where
    Choices: Tuple<AsList = (P, Ps)>,
    (P, Ps): List<AsTuple = Choices>,
    P: Actionable<E>,
    Ps: EachActionable<E> + List,
    E: Environment,
    E::Dual: Environment,
    P::Dual: Actionable<E::Dual>,
    <P::Env as EachSession>::Dual: Environment,
    <<P::Action as Actionable<P::Env>>::Env as EachSession>::Dual: Environment,
    <<P::Dual as Actionable<E::Dual>>::Env as EachSession>::Dual: Environment
[src]

#[must_use = "all possible choices must be handled (add cases to match the type of this `Offer<...>`)"]pub fn case(
    self
) -> Result<Chan<Tx, Rx, <P as Actionable<E>>::Action, <P as Actionable<E>>::Env>, Branches<Tx, Rx, Ps::AsTuple, E>>
[src]

Check if the selected protocol in this Branches was P. If so, return the corresponding channel; otherwise, return all the other possibilities.

impl<'a, Tx, Rx, E: Environment> Branches<Tx, Rx, (), E> where
    E::Dual: Environment
[src]

pub fn empty_case<T>(self) -> Result<T, OutOfRangeChoice>[src]

Attempt to eliminate an empty Branches, returning an error if the originating discriminant for this set of protocol choices was out of range.

This function is only callable on empty Branches, which under ordinary circumstances means it proves the unreachability of its calling location. However, if the other end of the channel breaks protocol, an empty Branches can in fact be constructed, and this function will then signal an error.

Trait Implementations

impl<Tx: Debug, Rx: Debug, Choices: Debug, E: Debug> Debug for Branches<Tx, Rx, Choices, E> where
    Choices: Tuple,
    Choices::AsList: EachActionable<E>,
    E: Environment,
    E::Dual: Environment
[src]

Auto Trait Implementations

impl<Tx, Rx, Choices, E> RefUnwindSafe for Branches<Tx, Rx, Choices, E> where
    Choices: RefUnwindSafe,
    E: RefUnwindSafe,
    Rx: RefUnwindSafe,
    Tx: RefUnwindSafe
[src]

impl<Tx, Rx, Choices, E> Send for Branches<Tx, Rx, Choices, E> where
    Choices: Send,
    E: Send,
    Rx: Send,
    Tx: Send
[src]

impl<Tx, Rx, Choices, E> Sync for Branches<Tx, Rx, Choices, E> where
    Choices: Sync,
    E: Sync,
    Rx: Sync,
    Tx: Sync
[src]

impl<Tx, Rx, Choices, E> Unpin for Branches<Tx, Rx, Choices, E> where
    Choices: Unpin,
    E: Unpin,
    Rx: Unpin,
    Tx: Unpin
[src]

impl<Tx, Rx, Choices, E> UnwindSafe for Branches<Tx, Rx, Choices, E> where
    Choices: UnwindSafe,
    E: UnwindSafe,
    Rx: UnwindSafe,
    Tx: 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<'a, T> CallBy<'a, Mut> for T where
    T: 'a, 
[src]

type Type = &'a mut T

The type of Self when called by Convention.

impl<'a, T> CallBy<'a, Ref> for T where
    T: 'a, 
[src]

type Type = &'a T

The type of Self when called by Convention.

impl<'a, T> CallBy<'a, Val> for T[src]

type Type = T

The type of Self when called by Convention.

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[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.