Trait loga::ResultContext

source ·
pub trait ResultContext<O> {
    // Required methods
    fn context(self, message: &'static str) -> Result<O, Error>;
    fn context_with(
        self,
        message: &'static str,
        attrs: impl Fn(&mut HashMap<&'static str, String>)
    ) -> Result<O, Error>;
    fn log_context(self, log: &Log, message: &'static str) -> Result<O, Error>;
    fn log_context_with(
        self,
        log: &Log,
        message: &'static str,
        attrs: impl Fn(&mut HashMap<&'static str, String>)
    ) -> Result<O, Error>;
    fn warn(self, log: &Log, message: &'static str);
    fn warn_with(
        self,
        log: &Log,
        message: &'static str,
        attrs: impl Fn(&mut HashMap<&'static str, String>)
    );
}

Required Methods§

source

fn context(self, message: &'static str) -> Result<O, Error>

If the value is Err/None, add a simple context string onto an error, converting it to loga::Error in the process.

source

fn context_with( self, message: &'static str, attrs: impl Fn(&mut HashMap<&'static str, String>) ) -> Result<O, Error>

If the value is Err/None, add a simple context string and attributes pairs onto an error, converting it to loga::Error in the process.

source

fn log_context(self, log: &Log, message: &'static str) -> Result<O, Error>

If the value is Err/None, add attributes from the log as well as a simple context string to an error, converting it to loga::Error in the process.

source

fn log_context_with( self, log: &Log, message: &'static str, attrs: impl Fn(&mut HashMap<&'static str, String>) ) -> Result<O, Error>

If the value is Err/None, add attributes from the log as well as the specified attributes and a simple context string to an error, converting it to loga::Error in the process.

source

fn warn(self, log: &Log, message: &'static str)

source

fn warn_with( self, log: &Log, message: &'static str, attrs: impl Fn(&mut HashMap<&'static str, String>) )

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<O> ResultContext<O> for Option<O>

source§

fn context(self, message: &'static str) -> Result<O, Error>

source§

fn context_with( self, message: &'static str, attrs: impl Fn(&mut HashMap<&'static str, String>) ) -> Result<O, Error>

source§

fn log_context(self, log: &Log, message: &'static str) -> Result<O, Error>

source§

fn log_context_with( self, log: &Log, message: &'static str, attrs: impl Fn(&mut HashMap<&'static str, String>) ) -> Result<O, Error>

source§

fn warn(self, log: &Log, message: &'static str)

source§

fn warn_with( self, log: &Log, message: &'static str, attrs: impl Fn(&mut HashMap<&'static str, String>) )

source§

impl<O, T: Into<Error>> ResultContext<O> for Result<O, T>

source§

fn context(self, message: &'static str) -> Result<O, Error>

source§

fn context_with( self, message: &'static str, attrs: impl Fn(&mut HashMap<&'static str, String>) ) -> Result<O, Error>

source§

fn log_context(self, log: &Log, message: &'static str) -> Result<O, Error>

source§

fn log_context_with( self, log: &Log, message: &'static str, attrs: impl Fn(&mut HashMap<&'static str, String>) ) -> Result<O, Error>

source§

fn warn(self, log: &Log, message: &'static str)

source§

fn warn_with( self, log: &Log, message: &'static str, attrs: impl Fn(&mut HashMap<&'static str, String>) )

Implementors§