Skip to main content

Bundle

Trait Bundle 

Source
pub trait Bundle<T, C> {
    type Bundled;

    // Required method
    fn bundle(self, context: C) -> Result<T, Self::Bundled>;
}
Expand description

Extension trait for bundling context with errors through Result types

Required Associated Types§

Source

type Bundled

The output error type after bundling with the provided context

Required Methods§

Source

fn bundle(self, context: C) -> Result<T, Self::Bundled>

use extracterr::{Bundle, Bundled};

struct Dummy(i32);

fn do_thing() -> Result<(), std::io::Error> {
    // ...
}

let r = do_thing().bundle(Dummy(0)); //: Result<(), Bundled<std::io::Error, Dummy>>

Implementations on Foreign Types§

Source§

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

Source§

type Bundled = Bundled<E, C>

Source§

fn bundle(self, context: C) -> Result<T, Self::Bundled>

Implementors§