Skip to main content

ResultMetricExt

Trait ResultMetricExt 

Source
pub trait ResultMetricExt<T> {
    type Error;

    // Required methods
    fn metric_err(
        self,
        family: &'static str,
        kind: ErrorKind,
    ) -> MetricResult<T>;
    fn metric_err_with(
        self,
        family: &'static str,
        classify: impl FnOnce(&Self::Error) -> ErrorKind,
    ) -> MetricResult<T>
       where Self: Sized;
}
Expand description

Convert a metric crate’s own Result into a MetricResult, locating the error at the caller.

Required Associated Types§

Source

type Error

The wrapped error type.

Required Methods§

Source

fn metric_err(self, family: &'static str, kind: ErrorKind) -> MetricResult<T>

Wrap the error as the detail of a kind MetricError stamped with family.

Source

fn metric_err_with( self, family: &'static str, classify: impl FnOnce(&Self::Error) -> ErrorKind, ) -> MetricResult<T>
where Self: Sized,

Like Self::metric_err, choosing the kind from the error value.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T, E> ResultMetricExt<T> for Result<T, E>
where E: Error + Send + Sync + 'static,

Source§

type Error = E

Source§

fn metric_err(self, family: &'static str, kind: ErrorKind) -> MetricResult<T>

Source§

fn metric_err_with( self, family: &'static str, classify: impl FnOnce(&E) -> ErrorKind, ) -> MetricResult<T>

Implementors§