1pub trait JaapResult { 2 fn for_error<F: FnOnce() -> ()>(self, f: F) -> Self; 3} 4 5impl<T, E> JaapResult for Result<T, E> { 6 fn for_error<F: FnOnce() -> ()>(self, f: F) -> Self { 7 if self.is_err() { 8 f(); 9 } 10 self 11 } 12}