pub trait OptionPrinter {
// Required methods
fn error_none<M: Display>(self, message: M) -> Self;
fn warn_none<M: Display>(self, message: M) -> Self;
fn debug_none<M: Display>(self, message: M) -> Self;
fn info_none<M: Display>(self, message: M) -> Self;
}Expand description
A helper trait to log when an option is None. The logging functions will track the caller’s callsite. For a chain of calls A -> B -> C -> OptionPrinter, the topmost function without #[track_caller] is deemed the callsite.
Required Methods§
fn error_none<M: Display>(self, message: M) -> Self
fn warn_none<M: Display>(self, message: M) -> Self
fn debug_none<M: Display>(self, message: M) -> Self
fn info_none<M: Display>(self, message: M) -> Self
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T> OptionPrinter for Option<T>
impl<T> OptionPrinter for Option<T>
Source§fn error_none<M: Display>(self, message: M) -> Self
fn error_none<M: Display>(self, message: M) -> Self
If self is None, prints out the message to tracing::error.
Source§fn warn_none<M: Display>(self, message: M) -> Self
fn warn_none<M: Display>(self, message: M) -> Self
If self is None, prints out the message to tracing::warn.
Source§fn debug_none<M: Display>(self, message: M) -> Self
fn debug_none<M: Display>(self, message: M) -> Self
If self is None, prints out the message to tracing::debug.