Skip to main content

ManagedResult

Trait ManagedResult 

Source
pub trait ManagedResult<T, E> {
    // Required methods
    fn reject<M>(self, managed: &Managed<M>) -> Result<T, Rejected<E::Error>>
       where Self: Sized,
             M: Counted,
             E: OutcomeError;
    fn reject2<M, N>(
        self,
        managed1: &Managed<M>,
        managed2: &Managed<N>,
    ) -> Result<T, Rejected<E::Error>>
       where Self: Sized,
             M: Counted,
             N: Counted,
             E: OutcomeError;
    fn with_outcome(self, outcome: Outcome) -> Result<T, (Outcome, E)>
       where Self: Sized;
}
Expand description

Extension trait for Results, which adds convenience functions to work with errors and Managed.

Required Methods§

Source

fn reject<M>(self, managed: &Managed<M>) -> Result<T, Rejected<E::Error>>
where Self: Sized, M: Counted, E: OutcomeError,

Reject the entire Managed instance with E.

Source

fn reject2<M, N>( self, managed1: &Managed<M>, managed2: &Managed<N>, ) -> Result<T, Rejected<E::Error>>
where Self: Sized, M: Counted, N: Counted, E: OutcomeError,

Reject two Managed instances while still only returning a single Rejected error in the result.

Source

fn with_outcome(self, outcome: Outcome) -> Result<T, (Outcome, E)>
where Self: Sized,

Wraps the error of the Result with an outcome.

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

Source§

fn reject<M>(self, managed: &Managed<M>) -> Result<T, Rejected<E::Error>>
where Self: Sized, M: Counted, E: OutcomeError,

Source§

fn reject2<M, N>( self, managed1: &Managed<M>, managed2: &Managed<N>, ) -> Result<T, Rejected<E::Error>>
where Self: Sized, M: Counted, N: Counted, E: OutcomeError,

Source§

fn with_outcome(self, outcome: Outcome) -> Result<T, (Outcome, E)>
where Self: Sized,

Implementors§