pub trait ResultExt {
    type Ok;

    fn attach<A>(self, attachment: A) -> Self
    where
        A: Send + Sync + 'static
; fn attach_lazy<A, F>(self, attachment: F) -> Self
    where
        A: Send + Sync + 'static,
        F: FnOnce() -> A
; fn attach_printable<A>(self, attachment: A) -> Self
    where
        A: Display + Debug + Send + Sync + 'static
; fn attach_printable_lazy<A, F>(self, attachment: F) -> Self
    where
        A: Display + Debug + Send + Sync + 'static,
        F: FnOnce() -> A
; fn change_context<C>(self, context: C) -> Result<Self::Ok, C>
    where
        C: Context
; fn change_context_lazy<C, F>(self, context: F) -> Result<Self::Ok, C>
    where
        C: Context,
        F: FnOnce() -> C
; }
Expand description

Extension trait for Result to provide context information on Reports.

Required Associated Types§

source

type Ok

Type of the Ok value in the Result

Required Methods§

source

fn attach<A>(self, attachment: A) -> Selfwhere
    A: Send + Sync + 'static,

Adds a new attachment to the Report inside the Result.

Applies Report::attach on the Err variant, refer to it for more information.

source

fn attach_lazy<A, F>(self, attachment: F) -> Selfwhere
    A: Send + Sync + 'static,
    F: FnOnce() -> A,

Lazily adds a new attachment to the Report inside the Result.

Applies Report::attach on the Err variant, refer to it for more information.

source

fn attach_printable<A>(self, attachment: A) -> Selfwhere
    A: Display + Debug + Send + Sync + 'static,

Adds a new printable attachment to the Report inside the Result.

Applies Report::attach_printable on the Err variant, refer to it for more information.

source

fn attach_printable_lazy<A, F>(self, attachment: F) -> Selfwhere
    A: Display + Debug + Send + Sync + 'static,
    F: FnOnce() -> A,

Lazily adds a new printable attachment to the Report inside the Result.

Applies Report::attach_printable on the Err variant, refer to it for more information.

source

fn change_context<C>(self, context: C) -> Result<Self::Ok, C>where
    C: Context,

Changes the context of the Report inside the Result.

Applies Report::change_context on the Err variant, refer to it for more information.

source

fn change_context_lazy<C, F>(self, context: F) -> Result<Self::Ok, C>where
    C: Context,
    F: FnOnce() -> C,

Lazily changes the context of the Report inside the Result.

Applies Report::change_context on the Err variant, refer to it for more information.

Implementors§

source§

impl<T, C> ResultExt for Result<T, C>

§

type Ok = T