Skip to main content

ResultStandardization

Trait ResultStandardization 

Source
pub trait ResultStandardization<T> {
    // Required methods
    fn standardize_err(self) -> Result<T, TrustformersError>;
    fn standardize_err_with_operation(
        self,
        operation: &str,
    ) -> Result<T, TrustformersError>;
    fn standardize_err_with_component(
        self,
        component: &str,
    ) -> Result<T, TrustformersError>;
    fn standardize_err_with_context(
        self,
        operation: &str,
        component: &str,
    ) -> Result<T, TrustformersError>;
}
Expand description

Extension trait for Result types to add standardization

Required Methods§

Source

fn standardize_err(self) -> Result<T, TrustformersError>

Standardize any error in a Result

Source

fn standardize_err_with_operation( self, operation: &str, ) -> Result<T, TrustformersError>

Standardize with operation context

Source

fn standardize_err_with_component( self, component: &str, ) -> Result<T, TrustformersError>

Standardize with component context

Source

fn standardize_err_with_context( self, operation: &str, component: &str, ) -> Result<T, TrustformersError>

Standardize with full context

Implementations on Foreign Types§

Source§

impl<T, E> ResultStandardization<T> for Result<T, E>
where E: StandardError,

Implementors§