Trait binrw::error::ContextExt

source ·
pub trait ContextExt {
    // Required methods
    fn with_context<Frame: Into<BacktraceFrame>>(self, frame: Frame) -> Self;
    fn with_message(self, message: impl Into<Cow<'static, str>>) -> Self;
}
Expand description

The ContextExt trait allows extra information to be added to errors.

This is used to add tracking information to errors that bubble up from an inner field.

Required Methods§

source

fn with_context<Frame: Into<BacktraceFrame>>(self, frame: Frame) -> Self

Adds a new context frame to the error, consuming the original error.

source

fn with_message(self, message: impl Into<Cow<'static, str>>) -> Self

Adds a new frame of context to the error with the given message, consuming the original error.

This also adds the file name and line number of the caller to the error.

Implementors§