tower_web/response/
either.rs1use super::{Context, Response, Serializer};
2use futures::future::Either;
3use http;
4use util::tuple::Either2;
5use util::BufStream;
6
7impl<A, B> Response for Either<A, B>
8where
9 A: Response,
10 B: Response,
11{
12 type Buf = <Self::Body as BufStream>::Item;
13 type Body = Either2<<A as Response>::Body, <B as Response>::Body>;
14
15 fn into_http<S: Serializer>(self, context: &Context<S>) -> Result<http::Response<Self::Body>, ::Error> {
16 match self {
17 Either::A(a) => Either2::A::<A, B>(a).into_http(context),
18 Either::B(b) => Either2::B::<A, B>(b).into_http(context),
19 }
20 }
21}