pub trait ResultExt<T, E> {
// Required methods
fn ok_or_log_error(self) -> Option<T>;
fn ok_or_log_error_once(self) -> Option<T>;
fn warn_on_err_once(self, msg: impl Display) -> Option<T>;
fn unwrap_debug_or_log_error(self) -> Option<T>;
}
Required Methods§
sourcefn ok_or_log_error(self) -> Option<T>
fn ok_or_log_error(self) -> Option<T>
Logs an error if the result is an error and returns the result.
sourcefn ok_or_log_error_once(self) -> Option<T>
fn ok_or_log_error_once(self) -> Option<T>
Logs an error if the result is an error and returns the result, but only once.
sourcefn warn_on_err_once(self, msg: impl Display) -> Option<T>
fn warn_on_err_once(self, msg: impl Display) -> Option<T>
Log a warning if there is an Err
, but only log the exact same message once.
sourcefn unwrap_debug_or_log_error(self) -> Option<T>
fn unwrap_debug_or_log_error(self) -> Option<T>
Unwraps in debug builds otherwise logs an error if the result is an error and returns the result.
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
source§impl<T, E> ResultExt<T, E> for Result<T, E>where
E: Display,
impl<T, E> ResultExt<T, E> for Result<T, E>where
E: Display,
source§fn warn_on_err_once(self, msg: impl Display) -> Option<T>
fn warn_on_err_once(self, msg: impl Display) -> Option<T>
Log a warning if there is an Err
, but only log the exact same message once.