Trait azure_core::error::ResultExt

source ·
pub trait ResultExt<T>: Sealed {
    // Required methods
    fn map_kind(self, kind: ErrorKind) -> Result<T>
       where Self: Sized;
    fn context<C>(self, kind: ErrorKind, message: C) -> Result<T>
       where Self: Sized,
             C: Into<Cow<'static, str>>;
    fn with_context<F, C>(self, kind: ErrorKind, f: F) -> Result<T>
       where Self: Sized,
             F: FnOnce() -> C,
             C: Into<Cow<'static, str>>;
}
Expand description

An extension to the Result type that easy allows creating Error values from existing errors

This trait cannot be implemented on custom types and is meant for usage with Result

Required Methods§

source

fn map_kind(self, kind: ErrorKind) -> Result<T>
where Self: Sized,

Creates a new error with the specified kind

source

fn context<C>(self, kind: ErrorKind, message: C) -> Result<T>
where Self: Sized, C: Into<Cow<'static, str>>,

Creates a new error with the specified kind and message

source

fn with_context<F, C>(self, kind: ErrorKind, f: F) -> Result<T>
where Self: Sized, F: FnOnce() -> C, C: Into<Cow<'static, str>>,

Creates a new error with the specified kind and formatted message

Implementations on Foreign Types§

source§

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

source§

fn map_kind(self, kind: ErrorKind) -> Result<T>
where Self: Sized,

source§

fn context<C>(self, kind: ErrorKind, message: C) -> Result<T>
where Self: Sized, C: Into<Cow<'static, str>>,

source§

fn with_context<F, C>(self, kind: ErrorKind, f: F) -> Result<T>
where Self: Sized, F: FnOnce() -> C, C: Into<Cow<'static, str>>,

Implementors§