with

Function with 

Source
pub fn with(context: impl Display) -> impl FnOnce(Error) -> Error
Expand description

Lazily attach a message to an io::Error. This is particularly useful combined with Result::map_err.

use io_extra::with;
File::open(path).map_err(with("failed to open log file"))?;