Trait wlan_hw_sim::event::Try

source ·
pub trait Try {
    type Output;
    type Residual;

    // Required methods
    fn from_output(output: Self::Output) -> Self;
    fn from_residual(residual: Self::Residual) -> Self;
    fn branch(self) -> ControlFlow<Self::Residual, Self::Output>;

    // Provided methods
    fn unwrap(self) -> Self::Output
       where Self: Sized { ... }
    fn expect(self, message: impl Display) -> Self::Output
       where Self: Sized { ... }
}
Expand description

Divergent (fallible) types.

This trait abstracts the branching of types that represent independent outputs and non-outputs (errors). Such types must be constructible from these variants and queried for a corresponding control flow.

Required Associated Types§

Required Methods§

source

fn from_output(output: Self::Output) -> Self

source

fn from_residual(residual: Self::Residual) -> Self

source

fn branch(self) -> ControlFlow<Self::Residual, Self::Output>

Provided Methods§

source

fn unwrap(self) -> Self::Output
where Self: Sized,

source

fn expect(self, message: impl Display) -> Self::Output
where Self: Sized,

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<T> Try for Option<T>

§

type Output = T

§

type Residual = Option<Infallible>

source§

fn from_output(output: Self::Output) -> Self

source§

fn from_residual(_: Self::Residual) -> Self

source§

fn branch(self) -> ControlFlow<Self::Residual, Self::Output>

source§

impl<T, E> Try for Result<T, E>

§

type Output = T

§

type Residual = Result<Infallible, E>

source§

fn from_output(output: Self::Output) -> Self

source§

fn from_residual(residual: Self::Residual) -> Self

source§

fn branch(self) -> ControlFlow<Self::Residual, Self::Output>

Implementors§