Trait rocket::outcome::IntoOutcome

source ·
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<'a, S, E> IntoOutcome<S, (Status, E), Data> for Result<S, E>

source§

type Failure = Status

source§

type Forward = Data

source§

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

source§

fn or_forward(self, data: Data) -> Outcome<S, E>

source§

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

source§

type Failure = Status

source§

type Forward = ()

source§

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

source§

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

source§

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

source§

type Failure = E

source§

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§