Trait clierr::DescribeErr
[−]
[src]
pub trait DescribeErr: Sized { type Described; fn describe_err<D>(self, description: D) -> Self::Described where D: Into<Cow<'static, str>>; fn describe_err_with<F, D>(self, with: F) -> Self::Described where F: FnOnce() -> D, D: Into<Cow<'static, str>>; }
A trait which enables adding a description to any Result
by wrapping its error type in an
Error
An implementation is provided for Result<S, E: std::errror::Error
and it's not really meant to
be implemented for anything else (unless you're using some kind of custom Result
type).
Associated Types
type Described
The result of describing the Result
's error.
Required Methods
fn describe_err<D>(self, description: D) -> Self::Described where D: Into<Cow<'static, str>>
Wraps the error contained by Self
in an Error
with the given description.
fn describe_err_with<F, D>(self, with: F) -> Self::Described where F: FnOnce() -> D, D: Into<Cow<'static, str>>
Same as describe_err
, but defer the construction of the description until it's actually
needed (i.e. only in the error case for a Result
).