Skip to main content

AsContext

Trait AsContext 

Source
pub trait AsContext {
    // Required method
    fn offer<R>(self, op: impl FnOnce() -> R) -> R;
}
Expand description

Implemented by types that can offer themselves as context to a child call.

Required Methods§

Source

fn offer<R>(self, op: impl FnOnce() -> R) -> R

Call op within the context of a Layer containing self.

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.

Implementors§

Source§

impl<T> AsContext for T
where T: Debug + Sized + 'static,