[][src]Trait failchain::ResultExt

pub trait ResultExt: Sized {
    type Success;
    type Error: Fail;
    fn chain_inspect_err<ErrorKindT: ChainErrorKind>(
        self,
        map: impl FnOnce(&mut Self::Error) -> ErrorKindT
    ) -> Result<Self::Success, ErrorKindT::Error>; fn chain_err<ErrorKindT: ChainErrorKind>(
        self,
        map: impl FnOnce() -> ErrorKindT
    ) -> Result<Self::Success, ErrorKindT::Error> { ... } }

Extension trait which adds the family of .chain_err methods to Result objects.

Associated Types

type Success

type Error: Fail

Loading content...

Required methods

fn chain_inspect_err<ErrorKindT: ChainErrorKind>(
    self,
    map: impl FnOnce(&mut Self::Error) -> ErrorKindT
) -> Result<Self::Success, ErrorKindT::Error>

Like chain_err, but the callback is given an opportunity to inspect the original error.

Loading content...

Provided methods

fn chain_err<ErrorKindT: ChainErrorKind>(
    self,
    map: impl FnOnce() -> ErrorKindT
) -> Result<Self::Success, ErrorKindT::Error>

Replace the error in a Result with a new error built from map's ErrorKind output.

The original error is stored as the cause/source of the new one.

Loading content...

Implementations on Foreign Types

impl<SuccessT, ErrorT: Fail> ResultExt for Result<SuccessT, ErrorT>[src]

type Success = SuccessT

type Error = ErrorT

fn chain_err<ErrorKindT: ChainErrorKind>(
    self,
    map: impl FnOnce() -> ErrorKindT
) -> Result<Self::Success, ErrorKindT::Error>
[src]

Loading content...

Implementors

Loading content...