pub trait OptionExt {
type Output;
// Required methods
fn unwrap_or_default_log(self) -> Self::Output;
fn unwrap_or_else_log(
self,
f: impl FnOnce() -> Self::Output,
) -> Self::Output;
fn unwrap_or_log(self, default: Self::Output) -> Self::Output;
}Expand description
Extension trait providing tracing alternatives to Option unwrap methods.
Required Associated Types§
Required Methods§
Sourcefn unwrap_or_default_log(self) -> Self::Output
fn unwrap_or_default_log(self) -> Self::Output
Returns the contained Some value, or logs at the warn level and returns a default value.
Sourcefn unwrap_or_else_log(self, f: impl FnOnce() -> Self::Output) -> Self::Output
fn unwrap_or_else_log(self, f: impl FnOnce() -> Self::Output) -> Self::Output
Returns the contained Some value, or logs at the warn level and computes a default value from a closure.
Sourcefn unwrap_or_log(self, default: Self::Output) -> Self::Output
fn unwrap_or_log(self, default: Self::Output) -> Self::Output
Returns the contained Some value, or logs at the warn level and returns the provided default.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.