Skip to main content

ResultChainError

Trait ResultChainError 

Source
pub trait ResultChainError<T, O: ErrorCategory, Tag> {
    // Required method
    fn chain_err(self, error_code: O) -> Result<T, Error<O>>;
}
Expand description

A trait that allows chaining if a Result contains an Error value.

Required Methods§

Source

fn chain_err(self, error_code: O) -> Result<T, Error<O>>

If the results contains an Err value, chain it with the supplied error_code and return Err with the result, otherwise forward the Ok value.

§Panics

If this Result is an Err value and the error category O is not linked with the ErrorCategory of the most recent error code in the error, this function will panic.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<OK, ERR, O, TAG> ResultChainError<OK, O, TAG> for Result<OK, ERR>
where O: ErrorCategory, ERR: ChainError<O, TAG>,

Source§

fn chain_err(self, error_code: O) -> Result<OK, Error<O>>

Implementors§