Skip to main content

GResultExt

Trait GResultExt 

Source
pub trait GResultExt<T, E>: Sealed {
    // Required methods
    fn gerr<C: Config, D>(
        self,
        id: C::Id,
        message: impl Into<Cow<'static, str>>,
    ) -> Result<T, C, D>;
    fn gerr_auto<C: Config, D>(
        self,
        message: impl Into<Cow<'static, str>>,
    ) -> Result<T, C, D>;
    fn wrap_gerr<C: Config, D>(self, gerr: GErr<C, D>) -> Result<T, C, D>;
    fn boxed(self) -> Result<T, Box<E>>;
}
Expand description

Result extension where E is GErr or any error implementing Into<GErrSource>.

Use this extension if you pass GErr or Into<GErrSource> from Result’s E and want to keep the detail attributes.

Required Methods§

Source

fn gerr<C: Config, D>( self, id: C::Id, message: impl Into<Cow<'static, str>>, ) -> Result<T, C, D>

Wrap E as GErr’s source, where E is Into<GErrSource>, and id is manually-set.

Source

fn gerr_auto<C: Config, D>( self, message: impl Into<Cow<'static, str>>, ) -> Result<T, C, D>

Wrap E as GErr’s source, where E is Into<GErrSource>, and id is auto-generated.

Source

fn wrap_gerr<C: Config, D>(self, gerr: GErr<C, D>) -> Result<T, C, D>

Wrap E inside GErr

Source

fn boxed(self) -> Result<T, Box<E>>

Box E

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

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

Source§

fn wrap_gerr<C: Config, D>(self, gerr: GErr<C, D>) -> Result<T, C, D>

Wrap E inside GErr

Source§

fn gerr<C: Config, D>( self, id: C::Id, message: impl Into<Cow<'static, str>>, ) -> Result<T, C, D>

Source§

fn gerr_auto<C: Config, D>( self, message: impl Into<Cow<'static, str>>, ) -> Result<T, C, D>

Source§

fn boxed(self) -> Result<T, Box<E>>

Implementors§