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§
sourcefn context<C: Display>(self, context: C) -> Self
fn context<C: Display>(self, context: C) -> Self
Wraps the error value with additional context.
sourcefn with_context<C: Display>(self, f: impl FnOnce(&Error) -> C) -> Self
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.