#[macro_export] macro_rules! generate_result_logging_extension { { $name: ident, $map_name: ident, $map_str_name: ident, $map_err_name: ident, $map_err_str_name: ident, $closure: expr } => { pub trait InfoResult : Sized { fn $map_name String>(self, f: F) -> Self; fn $map_str_name(self, s: &str) -> Self { self.$map_name(|_| format!("{}", s)) } fn $map_err_name String>(self, f: F) -> Self; fn $map_err_str_name(self, s: &str) -> Self { self.$map_err_name(|_| format!("{}", s)) } } impl InfoResult for Result { fn $map_name String>(self, f: F) -> Self { self.map(|x| { $closure(f(&x)); x }) } fn $map_err_name String>(self, f: F) -> Self { self.map_err(|e| { $closure(f(&e)); e }) } } } }