pub trait BuilderExt: Sized {
type Result<E>;
type E;
type S: State + ?Sized;
type F: PayloadFn;
type L: Literal + ?Sized;
// Required methods
fn with_context_ty<L>(
self,
) -> Self::Result<Builder<Self::E, Self::S, Self::F, L>>
where L: Context;
fn with_state<S>(
self,
state: S,
) -> Self::Result<Builder<Self::E, S, Self::F, Self::L>>
where S: State + Sized;
fn with_payload_fn<F>(
self,
payload_fn: F,
) -> Self::Result<Builder<Self::E, Self::S, F, Self::L>>
where F: PayloadFn;
// Provided methods
fn with_context<L>(
self,
_ty: L,
) -> Self::Result<Builder<Self::E, Self::S, Self::F, L>>
where L: Context { ... }
fn with_payload<P>(
self,
payload: P,
) -> Self::Result<Builder<Self::E, Self::S, Immediate<P>, Self::L>>
where P: Display + Send + Sync + 'static { ... }
}Expand description
Extension trait for attaching context, state, or payload to an existing error.
Required Associated Types§
type Result<E>
type E
type S: State + ?Sized
type F: PayloadFn
type L: Literal + ?Sized
Required Methods§
Sourcefn with_context_ty<L>(
self,
) -> Self::Result<Builder<Self::E, Self::S, Self::F, L>>where
L: Context,
fn with_context_ty<L>(
self,
) -> Self::Result<Builder<Self::E, Self::S, Self::F, L>>where
L: Context,
Attaches a literal context identified by its type.
Provided Methods§
Sourcefn with_context<L>(
self,
_ty: L,
) -> Self::Result<Builder<Self::E, Self::S, Self::F, L>>where
L: Context,
fn with_context<L>(
self,
_ty: L,
) -> Self::Result<Builder<Self::E, Self::S, Self::F, L>>where
L: Context,
Attaches a static literal context.
For dynamic content, use with_payload instead. It’s encouraged to
just use .with_payload(".."), since in most cases we are wrapping a source error and
the allocation cost is already paid.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".