pub trait ResContext<T, E> {
// Required methods
fn context<M>(self, msg: M) -> Result<T, ErrorContext>
where M: Into<SharedString>;
fn with_context<M, F>(self, f: F) -> Result<T, ErrorContext>
where M: Into<SharedString>,
F: FnOnce() -> M;
}Expand description
A helper trait for annotating result errors and empty options
Required Methods§
Sourcefn context<M>(self, msg: M) -> Result<T, ErrorContext>where
M: Into<SharedString>,
fn context<M>(self, msg: M) -> Result<T, ErrorContext>where
M: Into<SharedString>,
Map the error into a new cloneable ErrorContext error, annotated with a specified context message
Sourcefn with_context<M, F>(self, f: F) -> Result<T, ErrorContext>
fn with_context<M, F>(self, f: F) -> Result<T, ErrorContext>
Map the error into a new cloneable ErrorContext error, annotated with a dynamically computed context
message
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.