pub trait Contextual<E> {
type Destination;
// Required method
fn build_error(self, source: E) -> Self::Destination;
}Expand description
Builds a target error from a context selector and a source error of type E.
Implemented automatically by the context selector structs generated by
#[derive(Oopsie)]. You rarely implement this manually, and most code never
names it directly — ResultExt::context and OptionExt::context drive
it. Reach for it only when building an error outside a Result/Option,
e.g. selector.build_error(source).
Required Associated Types§
Sourcetype Destination
type Destination
The destination error type being built by this context selector.
Required Methods§
Sourcefn build_error(self, source: E) -> Self::Destination
fn build_error(self, source: E) -> Self::Destination
Build the target error from this context selector and the source error.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".