LuaErrorContext

Trait LuaErrorContext 

pub trait LuaErrorContext: Sealed {
    // Required methods
    fn context<C>(self, context: C) -> Self
       where C: Display;
    fn with_context<C>(self, f: impl FnOnce(&Error) -> C) -> Self
       where C: Display;
}
Expand description

Provides the context method for Error and Result<T, Error>.

Required Methods§

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

Wraps the error value with additional context.

fn with_context<C>(self, f: impl FnOnce(&Error) -> C) -> Self
where C: Display,

Wrap the error value with additional context that is evaluated lazily only once an error does occur.

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§

§

impl<T> ErrorContext for Result<T, Error>

§

fn context<C>(self, context: C) -> Result<T, Error>
where C: Display,

§

fn with_context<C>(self, f: impl FnOnce(&Error) -> C) -> Result<T, Error>
where C: Display,

Implementors§