libbpf_rs

Trait ErrorExt

Source
pub trait ErrorExt: Sealed {
    type Output;

    // Required methods
    fn context<C>(self, context: C) -> Self::Output
       where C: IntoCowStr;
    fn with_context<C, F>(self, f: F) -> Self::Output
       where C: IntoCowStr,
             F: FnOnce() -> C;
}
Expand description

A trait providing ergonomic chaining capabilities to Error.

Required Associated Types§

Source

type Output

The output type produced by context and with_context.

Required Methods§

Source

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

Add context to this error.

Source

fn with_context<C, F>(self, f: F) -> Self::Output
where C: IntoCowStr, F: FnOnce() -> C,

Add context to this error, using a closure for lazy evaluation.

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 ErrorExt for Error

Source§

type Output = Error

Source§

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

Source§

fn with_context<C, F>(self, f: F) -> Self::Output
where C: IntoCowStr, F: FnOnce() -> C,

Implementors§

Source§

impl ErrorExt for libbpf_rs::Error

Source§

impl<T, E> ErrorExt for Result<T, E>
where E: ErrorExt,