pub trait IntoOutcome<S, E, F> {
    type Failure: Sized;
    type Forward: Sized;

    // Required methods
    fn into_outcome(self, failure: Self::Failure) -> Outcome<S, E, F>;
    fn or_forward(self, forward: Self::Forward) -> Outcome<S, E, F>;
}
Expand description

Conversion trait from some type into an Outcome type.

Required Associated Types§

source

type Failure: Sized

The type to use when returning an Outcome::Failure.

source

type Forward: Sized

The type to use when returning an Outcome::Forward.

Required Methods§

source

fn into_outcome(self, failure: Self::Failure) -> Outcome<S, E, F>

Converts self into an Outcome. If self represents a success, an Outcome::Success is returned. Otherwise, an Outcome::Failure is returned with failure as the inner value.

source

fn or_forward(self, forward: Self::Forward) -> Outcome<S, E, F>

Converts self into an Outcome. If self represents a success, an Outcome::Success is returned. Otherwise, an Outcome::Forward is returned with forward as the inner value.

Implementations on Foreign Types§

source§

impl<'r, S, E> IntoOutcome<S, (Status, E), (Data<'r>, Status)> for Result<S, E>

§

type Failure = Status

§

type Forward = (Data<'r>, Status)

source§

fn into_outcome(self, status: Status) -> Outcome<'r, S, E>

source§

fn or_forward(self, (data, status): (Data<'r>, Status)) -> Outcome<'r, S, E>

source§

impl<S, E> IntoOutcome<S, (Status, E), Status> for Result<S, E>

§

type Failure = Status

§

type Forward = Status

source§

fn into_outcome(self, status: Status) -> Outcome<S, E>

source§

fn or_forward(self, status: Status) -> Outcome<S, E>

source§

impl<S, E, F> IntoOutcome<S, E, F> for Option<S>

§

type Failure = E

§

type Forward = F

source§

fn into_outcome(self, failure: E) -> Outcome<S, E, F>

source§

fn or_forward(self, forward: F) -> Outcome<S, E, F>

Implementors§