IntoResult

Trait IntoResult 

Source
pub trait IntoResult {
    type Value;
    type Error;

    // Required method
    fn into_result(self) -> Result<Self::Value, Self::Error>;
}
Expand description

Tells the crate::bind! macro whether the given expression has a bindable value or an error.

Enables the crate::bind! macro to determine by representing the value as a Result whether to create a variable and bind it to the value, or to call the optional error handler and evaluate the execution flow control block.

Implemented by default for Result and Option, with () as Error for the latter.

For the usage example, refer to the crate::bind! macro documentation, which includes an example of using it with user-defined types.

Required Associated Types§

Source

type Value

Type of the value that the crate::bind! macro binds the created variable to.

Source

type Error

Type of the error that the crate::bind! macro passes as the only argument to the optional error handler.

Required Methods§

Source

fn into_result(self) -> Result<Self::Value, Self::Error>

Represents the expression value as Result

Implementations on Foreign Types§

Source§

impl<'a, T> IntoResult for &'a Mutex<T>

Source§

type Value = MutexGuard<'a, T>

Source§

type Error = PoisonError<<&'a Mutex<T> as IntoResult>::Value>

Source§

fn into_result(self) -> Result<Self::Value, Self::Error>

Source§

impl<T> IntoResult for Option<T>

Source§

type Value = T

Source§

type Error = ()

Source§

fn into_result(self) -> Result<Self::Value, Self::Error>

Source§

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

Source§

type Value = T

Source§

type Error = E

Source§

fn into_result(self) -> Result<Self::Value, Self::Error>

Implementors§