Type Alias Result

Source
pub type Result<T, E = BError> = Result<T, E>;
Expand description

Syntax sugar for std::Result<T, BError>

Aliased Type§

pub enum Result<T, E = BError> {
    Ok(T),
    Err(E),
}

Variants§

§1.0.0

Ok(T)

Contains the success value

§1.0.0

Err(E)

Contains the error value

Trait Implementations§

Source§

impl<T> Context<T> for Result<T, BError>

Source§

fn err_context<C: Into<ImmutStr>, F: FnOnce() -> C>( self, context: F, ) -> Result<T, BError>

Wrap the Err(E) in Result with more context, the existing E will be the cause. Read more
Source§

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

Source§

fn or_err(self, et: ErrorType, context: &'static str) -> Result<T, BError>
where E: Into<Box<dyn ErrorTrait + Send + Sync>>,

Wrap the E in Result with new ErrorType and context, the existing E will be the cause. Read more
Source§

fn or_err_with<C: Into<ImmutStr>, F: FnOnce() -> C>( self, et: ErrorType, context: F, ) -> Result<T, BError>
where E: Into<Box<dyn ErrorTrait + Send + Sync>>,

Similar to or_err(), but takes a closure, which is useful for constructing String.
Source§

fn explain_err<C: Into<ImmutStr>, F: FnOnce(E) -> C>( self, et: ErrorType, exp: F, ) -> Result<T, BError>

Replace the E in Result with a new Error generated from the current error Read more
Source§

fn or_fail(self) -> Result<T, BError>
where E: Into<Box<dyn ErrorTrait + Send + Sync>>,

Similar to or_err() but just to surface errors that are not Error (where ? cannot be used directly). Read more