pub type PathCtx<E> = ErrCtx<E, PathBuf>;Expand description
Additional path context for errors.
Aliased Type§
pub struct PathCtx<E> {
pub inner: E,
pub ctx: PathBuf,
}Fields§
§inner: EInner error
ctx: PathBufContext associated with error
Implementations§
Source§impl<E> PathCtx<E>
impl<E> PathCtx<E>
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));