Skip to main content

TrySpecImpl

Trait TrySpecImpl 

Source
pub trait TrySpecImpl: FromResidual<Self::Residual> + Try {
    // Required methods
    exec fn may_unwind(&self) -> bool;
    exec fn branch_model_is_valid() -> bool;
    exec fn branch_model(self) -> ControlFlow<Self::Residual, Self::Output>
       where Self: Sized;
}

Required Methods§

Source

exec fn may_unwind(&self) -> bool

Whether branch may unwind for this value.

Source

exec fn branch_model_is_valid() -> bool

The result of branch matches its functional spec

Source

exec fn branch_model(self) -> ControlFlow<Self::Residual, Self::Output>
where Self: Sized,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<B, C> TrySpecImpl for ControlFlow<B, C>

Source§

open spec fn may_unwind(&self) -> bool

{ false }
Source§

open spec fn branch_model_is_valid() -> bool

{ true }
Source§

open spec fn branch_model(self) -> ControlFlow<Self::Residual, Self::Output>

{
    match self {
        ControlFlow::Continue(v) => ControlFlow::Continue(v),
        ControlFlow::Break(e) => ControlFlow::Break(ControlFlow::Break(e)),
    }
}
Source§

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

Source§

open spec fn may_unwind(&self) -> bool

{ false }
Source§

open spec fn branch_model_is_valid() -> bool

{ true }
Source§

open spec fn branch_model(self) -> ControlFlow<Self::Residual, Self::Output>

{
    match self {
        Ok(v) => ControlFlow::Continue(v),
        Err(e) => ControlFlow::Break(Err(e)),
    }
}
Source§

impl<T> TrySpecImpl for Option<T>

Source§

open spec fn may_unwind(&self) -> bool

{ false }
Source§

open spec fn branch_model_is_valid() -> bool

{ true }
Source§

open spec fn branch_model(self) -> ControlFlow<Self::Residual, Self::Output>

{
    match self {
        Some(v) => ControlFlow::Continue(v),
        None => ControlFlow::Break(None),
    }
}

Implementors§