Skip to main content

Context

Trait Context 

Source
pub trait Context<T> {
    // Required method
    fn with_context<C>(self, context: impl FnOnce() -> C) -> Result<T>
       where C: Into<ErrorResponse>;

    // Provided method
    fn context<C>(self, context: C) -> Result<T>
       where Self: Sized,
             C: Into<ErrorResponse> { ... }
}

Required Methods§

Source

fn with_context<C>(self, context: impl FnOnce() -> C) -> Result<T>
where C: Into<ErrorResponse>,

Provided Methods§

Source

fn context<C>(self, context: C) -> Result<T>
where Self: Sized, C: Into<ErrorResponse>,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T, E> Context<T> for Result<T, E>
where E: Into<Error>,

Source§

fn with_context<C>(self, context: impl FnOnce() -> C) -> Result<T>
where C: Into<ErrorResponse>,

Source§

impl<T> Context<T> for Option<T>

Source§

fn with_context<C>(self, context: impl FnOnce() -> C) -> Result<T>
where C: Into<ErrorResponse>,

Implementors§