Skip to main content

ResultExt

Trait ResultExt 

Source
pub trait ResultExt<T> {
    // Required methods
    fn with_operation(
        self,
        operation: impl Into<String>,
    ) -> Result<T, TrustformersError>;
    fn with_component(
        self,
        component: impl Into<String>,
    ) -> Result<T, TrustformersError>;
    fn with_context_key(
        self,
        key: &str,
        value: impl Into<String>,
    ) -> Result<T, TrustformersError>;
}
Expand description

Extension trait for adding context to Results

Required Methods§

Source

fn with_operation( self, operation: impl Into<String>, ) -> Result<T, TrustformersError>

Add operation context to an error

Source

fn with_component( self, component: impl Into<String>, ) -> Result<T, TrustformersError>

Add component context to an error

Source

fn with_context_key( self, key: &str, value: impl Into<String>, ) -> Result<T, TrustformersError>

Add arbitrary context to an error

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<T, E> ResultExt<T> for Result<T, E>

Source§

fn with_operation( self, operation: impl Into<String>, ) -> Result<T, TrustformersError>

Source§

fn with_component( self, component: impl Into<String>, ) -> Result<T, TrustformersError>

Source§

fn with_context_key( self, key: &str, value: impl Into<String>, ) -> Result<T, TrustformersError>

Implementors§