use std::error::Error; use log::error; pub trait ResultExtension{ type Output; fn display_err_or_some(self) -> Option; } impl ResultExtension for Result{ type Output = T; fn display_err_or_some(self) -> Option { match self{ Ok(v) => Some(v), Err(e) => { error!("{}", e); None } } } }