pub trait ResultContext<K, T, E> {
// Required methods
fn kind(self, kind: K) -> UniResult<T, K>;
fn context(self, context: impl Into<Cow<'static, str>>) -> UniResult<T, K>
where K: Default;
fn kind_context(
self,
kind: K,
context: impl Into<Cow<'static, str>>,
) -> UniResult<T, K>;
fn wrap(self) -> UniResult<T, K>
where K: Default;
// Provided methods
fn kind_fn<F>(self, kind: F) -> UniResult<T, K>
where F: FnOnce(&Self) -> K,
Self: Sized { ... }
fn context_fn<F, S>(self, context: F) -> UniResult<T, K>
where F: FnOnce(&Self) -> S,
S: Into<Cow<'static, str>>,
K: Default,
Self: Sized { ... }
fn kind_context_fn<F, F2, S>(self, kind: F, context: F2) -> UniResult<T, K>
where F: FnOnce(&Self) -> K,
F2: FnOnce(&Self) -> S,
S: Into<Cow<'static, str>>,
Self: Sized { ... }
}Expand description
A trait for wrapping an existing result error with a additional context.
Required Methods§
Sourcefn kind(self, kind: K) -> UniResult<T, K>
fn kind(self, kind: K) -> UniResult<T, K>
Wraps the existing result error with the provided kind.
Sourcefn context(self, context: impl Into<Cow<'static, str>>) -> UniResult<T, K>where
K: Default,
fn context(self, context: impl Into<Cow<'static, str>>) -> UniResult<T, K>where
K: Default,
Wraps the existing result error with the provided context.
Provided Methods§
Sourcefn kind_fn<F>(self, kind: F) -> UniResult<T, K>
fn kind_fn<F>(self, kind: F) -> UniResult<T, K>
Wraps the existing result error with the provided kind.
Sourcefn context_fn<F, S>(self, context: F) -> UniResult<T, K>
fn context_fn<F, S>(self, context: F) -> UniResult<T, K>
Wraps the existing result error with the provided context.
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.