StackableErr

Trait StackableErr 

Source
pub trait StackableErr {
    type Output;

    // Required methods
    fn stack(self) -> Self::Output;
    fn stack_locationless(self) -> Self::Output;
    fn stack_err<E: Display + Send + Sync + 'static>(self, e: E) -> Self::Output;
    fn stack_err_with<E: Display + Send + Sync + 'static, F: FnOnce() -> E>(
        self,
        f: F,
    ) -> Self::Output;
    fn stack_err_locationless<E: Display + Send + Sync + 'static>(
        self,
        e: E,
    ) -> Self::Output;
    fn stack_err_with_locationless<E: Display + Send + Sync + 'static, F: FnOnce() -> E>(
        self,
        f: F,
    ) -> Self::Output;
    fn wrap_err<D: Display + Send + Sync + 'static>(
        self,
        msg: D,
    ) -> Self::Output;
    fn wrap_err_with<D: Display + Send + Sync + 'static, F: FnOnce() -> D>(
        self,
        msg: F,
    ) -> Self::Output;
    fn context<D: Display + Send + Sync + 'static>(self, msg: D) -> Self::Output;
    fn with_context<D: Display + Send + Sync + 'static, F: FnOnce() -> D>(
        self,
        msg: F,
    ) -> Self::Output;
}
Expand description

Conversion to and addition to the stack of a stackable_error::Error.

See the main crate documentation and implementation for examples.

Required Associated Types§

Required Methods§

Source

fn stack(self) -> Self::Output

Pushes just location information to the error stack

Source

fn stack_locationless(self) -> Self::Output

Only converts to Self::Output and pushes it on the error stack

Source

fn stack_err<E: Display + Send + Sync + 'static>(self, e: E) -> Self::Output

Pushes the result of f and location information to the error stack

Source

fn stack_err_with<E: Display + Send + Sync + 'static, F: FnOnce() -> E>( self, f: F, ) -> Self::Output

Pushes e and location information to the error stack

Source

fn stack_err_locationless<E: Display + Send + Sync + 'static>( self, e: E, ) -> Self::Output

Pushes e without location information to the error stack

Source

fn stack_err_with_locationless<E: Display + Send + Sync + 'static, F: FnOnce() -> E>( self, f: F, ) -> Self::Output

Pushes the result of f without location information to the error stack

Source

fn wrap_err<D: Display + Send + Sync + 'static>(self, msg: D) -> Self::Output

Alternate for StackableErr::stack_err which can be used for easier translation to and from the eyre crate

Source

fn wrap_err_with<D: Display + Send + Sync + 'static, F: FnOnce() -> D>( self, msg: F, ) -> Self::Output

Alternate for StackableErr::stack_err_with which can be used for easier translation to and from the eyre crate

Source

fn context<D: Display + Send + Sync + 'static>(self, msg: D) -> Self::Output

Alternate for StackableErr::stack_err which can be used for easier translation to and from the anyhow crate

Source

fn with_context<D: Display + Send + Sync + 'static, F: FnOnce() -> D>( self, msg: F, ) -> Self::Output

Alternate for StackableErr::stack_err_with which can be used for easier translation to and from the anyhow crate

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> StackableErr for Option<T>

Source§

type Output = Result<T, StackedError>

Source§

fn stack(self) -> Self::Output

Source§

fn stack_locationless(self) -> Self::Output

Source§

fn stack_err<E1: Display + Send + Sync + 'static>(self, e: E1) -> Self::Output

Source§

fn stack_err_with<E1: Display + Send + Sync + 'static, F: FnOnce() -> E1>( self, f: F, ) -> Self::Output

Source§

fn stack_err_locationless<E1: Display + Send + Sync + 'static>( self, e: E1, ) -> Self::Output

Source§

fn stack_err_with_locationless<E1: Display + Send + Sync + 'static, F: FnOnce() -> E1>( self, f: F, ) -> Self::Output

Source§

fn wrap_err<D: Display + Send + Sync + 'static>(self, msg: D) -> Self::Output

Source§

fn wrap_err_with<D: Display + Send + Sync + 'static, F: FnOnce() -> D>( self, msg: F, ) -> Self::Output

Source§

fn context<D: Display + Send + Sync + 'static>(self, msg: D) -> Self::Output

Source§

fn with_context<D: Display + Send + Sync + 'static, F: FnOnce() -> D>( self, msg: F, ) -> Self::Output

Source§

impl<T, E: Display + Send + Sync + 'static> StackableErr for Result<T, E>

Source§

type Output = Result<T, StackedError>

Source§

fn stack(self) -> Self::Output

Source§

fn stack_locationless(self) -> Self::Output

Source§

fn stack_err<E1: Display + Send + Sync + 'static>(self, e: E1) -> Self::Output

Source§

fn stack_err_with<E1: Display + Send + Sync + 'static, F: FnOnce() -> E1>( self, f: F, ) -> Self::Output

Source§

fn stack_err_locationless<E1: Display + Send + Sync + 'static>( self, e: E1, ) -> Self::Output

Source§

fn stack_err_with_locationless<E1: Display + Send + Sync + 'static, F: FnOnce() -> E1>( self, f: F, ) -> Self::Output

Source§

fn wrap_err<D: Display + Send + Sync + 'static>(self, msg: D) -> Self::Output

Source§

fn wrap_err_with<D: Display + Send + Sync + 'static, F: FnOnce() -> D>( self, msg: F, ) -> Self::Output

Source§

fn context<D: Display + Send + Sync + 'static>(self, msg: D) -> Self::Output

Source§

fn with_context<D: Display + Send + Sync + 'static, F: FnOnce() -> D>( self, msg: F, ) -> Self::Output

Implementors§