PathCtx

Type Alias PathCtx 

Source
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: E

Inner error

§ctx: PathBuf

Context associated with error

Implementations§

Source§

impl<E> PathCtx<E>

Source

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));