Trait mlua::ErrorContext

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

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

Required Methods§

source

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

Wraps the error value with additional context.

source

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

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

Implementations on Foreign Types§

source§

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

source§

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

source§

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

Implementors§