use std::fmt::Display;
use crate::AnyError;
pub trait AddContext<T, Err, CtxErr> {
fn add_context<D, F>(self, f: F) -> Result<T, CtxErr>
where
D: Display,
F: FnOnce() -> D;
}
impl<T> AddContext<T, AnyError, AnyError> for Result<T, AnyError> {
fn add_context<D, F>(self, f: F) -> Result<T, AnyError>
where
D: Display,
F: FnOnce() -> D,
{
self.map_err(|e| e.add_context(f))
}
}