pub trait ResultContext<T, E>: Sealed {
Show 15 methods
// Required methods
fn error(self, context: impl Display) -> Result<T, E>;
fn warn(self, context: impl Display) -> Result<T, E>;
fn info(self, context: impl Display) -> Result<T, E>;
fn debug(self, context: impl Display) -> Result<T, E>;
fn trace(self, context: impl Display) -> Result<T, E>;
fn with_error<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>;
fn with_warn<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>;
fn with_info<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>;
fn with_debug<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>;
fn with_trace<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>;
fn consume_with_error<F: FnOnce(E) -> D, D: Display>(
self,
f: F,
) -> Option<T>;
fn consume_with_warn<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>;
fn consume_with_info<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>;
fn consume_with_debug<F: FnOnce(E) -> D, D: Display>(
self,
f: F,
) -> Option<T>;
fn consume_with_trace<F: FnOnce(E) -> D, D: Display>(
self,
f: F,
) -> Option<T>;
}Available on crate features
tracing or log or defmt or context_stub only.Required Methods§
Sourcefn error(self, context: impl Display) -> Result<T, E>
fn error(self, context: impl Display) -> Result<T, E>
Log the context as an “error” if the Result is an Err.
Sourcefn warn(self, context: impl Display) -> Result<T, E>
fn warn(self, context: impl Display) -> Result<T, E>
Log the context as an “warn” if the Result is an Err.
Sourcefn info(self, context: impl Display) -> Result<T, E>
fn info(self, context: impl Display) -> Result<T, E>
Log the context as an “info” if the Result is an Err.
Sourcefn debug(self, context: impl Display) -> Result<T, E>
fn debug(self, context: impl Display) -> Result<T, E>
Log the context as an “debug” if the Result is an Err.
Sourcefn trace(self, context: impl Display) -> Result<T, E>
fn trace(self, context: impl Display) -> Result<T, E>
Log the context as an “trace” if the Result is an Err.
Sourcefn with_error<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
fn with_error<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
Lazily call [f] if the Result is an Err and log as an “error”.
Sourcefn with_warn<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
fn with_warn<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
Lazily call [f] if the Result is an Err and log as an “warn”.
Sourcefn with_info<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
fn with_info<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
Lazily call [f] if the Result is an Err and log as an “info”.
Sourcefn with_debug<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
fn with_debug<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
Lazily call [f] if the Result is an Err and log as an “debug”.
Sourcefn with_trace<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
fn with_trace<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
Lazily call [f] if the Result is an Err and log as an “trace”.
Sourcefn consume_with_error<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>
fn consume_with_error<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>
Sourcefn consume_with_warn<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>
fn consume_with_warn<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>
Sourcefn consume_with_info<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>
fn consume_with_info<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>
Sourcefn consume_with_debug<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>
fn consume_with_debug<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>
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.
Implementations on Foreign Types§
Source§impl<T, E> ResultContext<T, E> for Result<T, E>
impl<T, E> ResultContext<T, E> for Result<T, E>
Source§fn error(self, context: impl Display) -> Result<T, E>
fn error(self, context: impl Display) -> Result<T, E>
Available on crate features
tracing or log or defmt or context_stub only.Source§fn warn(self, context: impl Display) -> Result<T, E>
fn warn(self, context: impl Display) -> Result<T, E>
Available on crate features
tracing or log or defmt or context_stub only.Source§fn info(self, context: impl Display) -> Result<T, E>
fn info(self, context: impl Display) -> Result<T, E>
Available on crate features
tracing or log or defmt or context_stub only.Source§fn debug(self, context: impl Display) -> Result<T, E>
fn debug(self, context: impl Display) -> Result<T, E>
Available on crate features
tracing or log or defmt or context_stub only.Source§fn trace(self, context: impl Display) -> Result<T, E>
fn trace(self, context: impl Display) -> Result<T, E>
Available on crate features
tracing or log or defmt or context_stub only.Source§fn with_error<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
fn with_error<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
Available on crate features
tracing or log or defmt or context_stub only.Source§fn with_warn<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
fn with_warn<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
Available on crate features
tracing or log or defmt or context_stub only.Source§fn with_info<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
fn with_info<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
Available on crate features
tracing or log or defmt or context_stub only.Source§fn with_debug<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
fn with_debug<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
Available on crate features
tracing or log or defmt or context_stub only.Source§fn with_trace<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
fn with_trace<F: FnOnce(&E) -> D, D: Display>(self, f: F) -> Result<T, E>
Available on crate features
tracing or log or defmt or context_stub only.Source§fn consume_with_error<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>
fn consume_with_error<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>
Available on crate features
tracing or log or defmt or context_stub only.Source§fn consume_with_warn<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>
fn consume_with_warn<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>
Available on crate features
tracing or log or defmt or context_stub only.Source§fn consume_with_info<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>
fn consume_with_info<F: FnOnce(E) -> D, D: Display>(self, f: F) -> Option<T>
Available on crate features
tracing or log or defmt or context_stub only.