Context

Trait Context 

Source
pub trait Context {
    type WithContext;

    // Required methods
    fn context<D>(self, context: D) -> Self::WithContext
       where D: Display;
    fn with_context<D, F>(self, cfn: F) -> Self::WithContext
       where D: Display,
             F: FnOnce() -> D;
}
Expand description

The FVM’s equivalent of anyhow::Context. This is intentionally only implemented on ExecutionError and Result<T, ExecutionError> so anyhow::Context can be imported at the same time.

Required Associated Types§

Required Methods§

Source

fn context<D>(self, context: D) -> Self::WithContext
where D: Display,

Source

fn with_context<D, F>(self, cfn: F) -> Self::WithContext
where D: Display, F: FnOnce() -> D,

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.

Implementations on Foreign Types§

Source§

impl<T> Context for Result<T, ExecutionError>

Source§

type WithContext = Result<T, ExecutionError>

Source§

fn context<D>( self, context: D, ) -> <Result<T, ExecutionError> as Context>::WithContext
where D: Display,

Source§

fn with_context<D, F>( self, cfn: F, ) -> <Result<T, ExecutionError> as Context>::WithContext
where D: Display, F: FnOnce() -> D,

Implementors§