[][src]Enum actix_web::Either

pub enum Either<A, B> {

Combines two different responder types into a single type

use actix_web::{Either, Error, HttpResponse};

type RegisterResult =
    Either<HttpResponse, Box<Future<Item = HttpResponse, Error = Error>>>;

fn index() -> RegisterResult {
    if is_a_variant() {
        // <- choose left variant
        Either::A(HttpResponse::BadRequest().body("Bad data"))
    } else {
            // <- Right variant



First branch of the type


Second branch of the type

Trait Implementations

impl<A, B> Responder for Either<A, B> where
    A: Responder,
    B: Responder

type Error = Error

The associated error which can be returned.

type Future = EitherResponder<<A::Future as IntoFuture>::Future, <B::Future as IntoFuture>::Future>

The future response value.

fn with_status(self, status: StatusCode) -> CustomResponder<Self> where
    Self: Sized

Override a status code for a Responder. Read more

fn with_header<K, V>(self, key: K, value: V) -> CustomResponder<Self> where
    Self: Sized,
    HeaderName: HttpTryFrom<K>,
    V: IntoHeaderValue

Add header to the Responder's response. Read more

impl<A: PartialEq, B: PartialEq> PartialEq<Either<A, B>> for Either<A, B>[src]

impl<A: Debug, B: Debug> Debug for Either<A, B>[src]

Auto Trait Implementations

impl<A, B> Send for Either<A, B> where
    A: Send,
    B: Send

impl<A, B> Sync for Either<A, B> where
    A: Sync,
    B: Sync

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 

impl<T, U> TryFrom for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized

impl<T> Any for T where
    T: 'static + ?Sized

impl<T> BorrowMut for T where
    T: ?Sized

impl<T, U> TryInto for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Erased for T