pub struct Context<M, E> { /* private fields */ }
Expand description
Additional level of context, wrapping some error inside itself.
This is produced by the context
and implements the additional (outer)
layer in the chain. Any number of contexts can be chained together.
Implementations§
Source§impl<M, E> Context<M, E>
impl<M, E> Context<M, E>
Sourcepub fn new(msg: M, error: E) -> Self
pub fn new(msg: M, error: E) -> Self
A direct constructor for the context.
More usually created by the context
, but allowing for construction
directly without importing the trait.
Sourcepub fn into_inner(self) -> E
pub fn into_inner(self) -> E
Extracts the inner error, peeling off the outer layer.
Source§impl<M> Context<M, Compat<Error>>
impl<M> Context<M, Compat<Error>>
Sourcepub fn from_failure(msg: M, failure: Error) -> Self
pub fn from_failure(msg: M, failure: Error) -> Self
Constructor of context from a failure’s Error
.
This is a compatibility constructor, for wrapping the error of failure. It is enabled by
the failure
feature.
§Warning
The compatibility layer has no way to access the original causes of the failure. Therefore, the inner layers of the provided failure will be lost and the failure will be considered the innermost level.
Source§impl<M, F: Fail> Context<M, Compat<F>>
impl<M, F: Fail> Context<M, Compat<F>>
Sourcepub fn from_fail(msg: M, failure: F) -> Self
pub fn from_fail(msg: M, failure: F) -> Self
Constructor of context from a failure’s Fail
.
This is a compatibility constructor, for wrapping failure. It is enabled by the failure
feature.
§Warning
The compatibility layer has no way to access the original causes of the failure. Therefore, the inner layers of the provided failure will be lost and the failure will be considered the innermost level.
Trait Implementations§
Source§impl<M: Debug + Display, E: Error + 'static> Error for Context<M, E>
impl<M: Debug + Display, E: Error + 'static> Error for Context<M, E>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
impl<M: Copy, E: Copy> Copy for Context<M, E>
Auto Trait Implementations§
impl<M, E> Freeze for Context<M, E>
impl<M, E> RefUnwindSafe for Context<M, E>where
M: RefUnwindSafe,
E: RefUnwindSafe,
impl<M, E> Send for Context<M, E>
impl<M, E> Sync for Context<M, E>
impl<M, E> Unpin for Context<M, E>
impl<M, E> UnwindSafe for Context<M, E>where
M: UnwindSafe,
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<E> ErrorExt for Ewhere
E: Error,
impl<E> ErrorExt for Ewhere
E: Error,
Source§fn context<M>(self, msg: M) -> Context<M, E>where
M: Display,
fn context<M>(self, msg: M) -> Context<M, E>where
M: Display,
Source§fn chain(&self) -> Chain<'_> ⓘwhere
E: 'static,
fn chain(&self) -> Chain<'_> ⓘwhere
E: 'static,
Source§impl<E> Fail for E
impl<E> Fail for E
Source§fn cause(&self) -> Option<&(dyn Fail + 'static)>
fn cause(&self) -> Option<&(dyn Fail + 'static)>
Source§fn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
Backtrace
carried by this failure, if it
carries one. Read more