rocket::outcome

Trait 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§