pub struct ErrCtx<E, T> {
pub inner: E,
pub ctx: T,
}Expand description
Wrapper around an error providing additional context.
Fields§
§inner: EInner error
ctx: TContext associated with error
Implementations§
Source§impl<E> ErrCtx<E, PathBuf>
impl<E> ErrCtx<E, PathBuf>
Sourcepub fn f<P: AsRef<Path>>(path: P) -> Box<dyn FnOnce(E) -> Self>
pub fn f<P: AsRef<Path>>(path: P) -> Box<dyn FnOnce(E) -> Self>
Convenience method that creates a closure which converts an io::Error to a IoErrCtx
This is designed for simplifying the conversion of io::Errors using .map_err.
For example
let res = res.map_err(|e| PathCtx::new(e, path));can become
let res = res.map_err(PathCtx::f(path));Trait Implementations§
Source§impl<E: Error + 'static, T: Debug> Error for ErrCtx<E, T>
impl<E: Error + 'static, T: Debug> Error for ErrCtx<E, T>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Auto Trait Implementations§
impl<E, T> Freeze for ErrCtx<E, T>
impl<E, T> RefUnwindSafe for ErrCtx<E, T>where
E: RefUnwindSafe,
T: RefUnwindSafe,
impl<E, T> Send for ErrCtx<E, T>
impl<E, T> Sync for ErrCtx<E, T>
impl<E, T> Unpin for ErrCtx<E, T>
impl<E, T> UnwindSafe for ErrCtx<E, T>where
E: UnwindSafe,
T: 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
Mutably borrows from an owned value. Read more