Skip to main content

ICResultExt

Trait ICResultExt 

Source
pub trait ICResultExt<T, E> {
    // Required methods
    fn capture<Kind>(self) -> Result<T, ICError<Kind>>
       where E: Into<Kind>;
    fn capture_box<Kind>(self) -> Result<T, ICError<Kind>>
       where E: Error + Send + Sync + 'static,
             Box<dyn Error + Send + Sync + 'static>: Into<Kind>;
}
Expand description

Extension trait for converting Result<T, E> into Result<T, ICError<Kind>>, capturing a new span trace.

Required Methods§

Source

fn capture<Kind>(self) -> Result<T, ICError<Kind>>
where E: Into<Kind>,

Convert the error via E: Into<Kind>, capturing a new span trace.

Source

fn capture_box<Kind>(self) -> Result<T, ICError<Kind>>
where E: Error + Send + Sync + 'static, Box<dyn Error + Send + Sync + 'static>: Into<Kind>,

Box the error into Box<dyn Error>, then convert via Into<Kind>, capturing a new span trace.

Use this when the error kind has #[from] Box<dyn Error + Send + Sync>. When the kind instead has #[from] Box<ConcreteError>, use .map_err(Box::new).capture().

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

Source§

fn capture<Kind>(self) -> Result<T, ICError<Kind>>
where E: Into<Kind>,

Source§

fn capture_box<Kind>(self) -> Result<T, ICError<Kind>>
where E: Error + Send + Sync + 'static, Box<dyn Error + Send + Sync + 'static>: Into<Kind>,

Implementors§