wlan_hw_sim::event

Trait 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,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl<T> Try for Option<T>

Source§

type Output = T

Source§

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>

Source§

type Output = T

Source§

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§