1use extract::{self, ExtractFuture};
7use response::{Context, Response, Serializer};
8use routing::{self, Resource, ResourceFuture, IntoResource, RouteSet, RouteMatch};
9use util::{BufStream, Chain};
10use util::http::{HttpFuture, SealedFuture};
11
12use bytes::Buf;
13use futures::{Future, Stream, Async, Poll};
14use http;
15
16#[derive(Debug)]
23pub struct Join0 {
24 _p: (),
25}
26
27impl Join0 {
28 pub fn new() -> Self {
29 Self { _p: () }
30 }
31
32 pub fn into_inner(self) -> () {
33 ()
34 }
35}
36
37impl Future for Join0 {
38 type Item = ();
39 type Error = extract::Error;
40
41 fn poll(&mut self) -> Poll<(), extract::Error> {
42 Ok(().into())
43 }
44}
45
46impl<U> Chain<U> for () {
47 type Output = U;
48
49 fn chain(self, other: U) -> Self::Output {
50 other
51 }
52}
53#[derive(Debug, Clone)]
56pub enum Either1<A> {
57 A(A),
58}
59
60impl<A> Future for Either1<A>
61where
62 A: Future,
63{
64 type Item = Either1<A::Item>;
65 type Error = A::Error;
66
67 fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
68 use self::Either1::*;
69
70 match *self {
71 A(ref mut f) => Ok(A(try_ready!(f.poll())).into()),
72 }
73 }
74}
75
76impl<A> ResourceFuture for Either1<A>
77where
78 A: ResourceFuture,
79{
80 type Body = Either1<A::Body>;
81
82 fn poll_response(&mut self, request: &http::Request<()>) -> Poll<http::Response<Self::Body>, ::Error> {
83 use self::Either1::*;
84
85 let response = match *self {
86 A(ref mut f) => try_ready!(f.poll_response(request)).map(A),
87 };
88 Ok(response.into())
89 }
90}
91
92impl<A> Either1<A>
93where
94 A: ExtractFuture,
95{
96
97 pub fn poll_ready(&mut self) -> Poll<(), extract::Error> {
98 use self::Either1::*;
99
100 match *self {
101 A(ref mut f) => f.poll(),
102 }
103 }
104}
105
106impl<A> HttpFuture for Either1<A>
107where
108 A: HttpFuture,
109{
110 type Body = Either1<A::Body>;
111
112 fn poll_http(&mut self) -> Poll<http::Response<Self::Body>, ::Error> {
113 use self::Either1::*;
114
115 match *self {
116 A(ref mut f) => Ok(try_ready!(f.poll_http()).map(A).into()),
117 }
118 }
119}
120
121impl<A> SealedFuture for Either1<A>
122where
123 A: HttpFuture,
124{
125}
126
127impl<A> Stream for Either1<A>
128where
129 A: Stream,
130{
131 type Item = Either1<A::Item>;
132 type Error = A::Error;
133
134 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
135 use self::Either1::*;
136
137 match *self {
138 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
139 }
140 }
141}
142
143impl<A> BufStream for Either1<A>
144where
145 A: BufStream,
146{
147 type Item = Either1<A::Item>;
148 type Error = A::Error;
149
150 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
151 use self::Either1::*;
152
153 match *self {
154 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
155 }
156 }
157}
158
159impl<A> Buf for Either1<A>
160where
161 A: Buf,
162{
163 fn remaining(&self) -> usize {
164 use self::Either1::*;
165
166 match *self {
167 A(ref b) => b.remaining(),
168 }
169 }
170
171 fn bytes(&self) -> &[u8] {
172 use self::Either1::*;
173
174 match *self {
175 A(ref b) => b.bytes(),
176 }
177 }
178
179 fn advance(&mut self, cnt: usize) {
180 use self::Either1::*;
181
182 match *self {
183 A(ref mut b) => b.advance(cnt),
184 }
185 }
186}
187
188impl<A> Response for Either1<A>
189where
190 A: Response,
191{
192 type Buf = Either1<A::Buf>;
193 type Body = Either1<A::Body>;
194
195 fn into_http<S>(self, context: &Context<S>) -> Result<http::Response<Self::Body>, ::Error>
196 where S: Serializer
197 {
198 use self::Either1::*;
199
200 match self {
201 A(r) => Ok(r.into_http(context)?.map(Either1::A)),
202 }
203 }
204}
205
206impl<R0> Resource for (R0,)
207where
208 R0: Resource,
209{
210 type Destination = Either1<R0::Destination>;
211 type RequestBody = R0::RequestBody;
212 type Buf = Either1<R0::Buf>;
213 type Body = Either1<R0::Body>;
214 type Future = Either1<R0::Future>;
215
216 fn dispatch(&mut self,
217 destination: Self::Destination,
218 route_match: &RouteMatch,
219 body: Self::RequestBody)
220 -> Self::Future
221 {
222 use self::Either1::*;
223
224 match destination {
225 A(d) => {
226 A(self.0.dispatch(d, route_match, body))
227 }
228 }
229 }
230}
231#[derive(Debug, Clone)]
234pub enum Either2<A, B> {
235 A(A),
236 B(B),
237}
238
239impl<A, B> Future for Either2<A, B>
240where
241 A: Future,
242 B: Future<Error = A::Error>,
243{
244 type Item = Either2<A::Item, B::Item>;
245 type Error = A::Error;
246
247 fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
248 use self::Either2::*;
249
250 match *self {
251 A(ref mut f) => Ok(A(try_ready!(f.poll())).into()),
252 B(ref mut f) => Ok(B(try_ready!(f.poll())).into()),
253 }
254 }
255}
256
257impl<A, B> ResourceFuture for Either2<A, B>
258where
259 A: ResourceFuture,
260 B: ResourceFuture,
261{
262 type Body = Either2<A::Body, B::Body>;
263
264 fn poll_response(&mut self, request: &http::Request<()>) -> Poll<http::Response<Self::Body>, ::Error> {
265 use self::Either2::*;
266
267 let response = match *self {
268 A(ref mut f) => try_ready!(f.poll_response(request)).map(A),
269 B(ref mut f) => try_ready!(f.poll_response(request)).map(B),
270 };
271 Ok(response.into())
272 }
273}
274
275impl<A, B> Either2<A, B>
276where
277 A: ExtractFuture,
278 B: ExtractFuture,
279{
280
281 pub fn poll_ready(&mut self) -> Poll<(), extract::Error> {
282 use self::Either2::*;
283
284 match *self {
285 A(ref mut f) => f.poll(),
286 B(ref mut f) => f.poll(),
287 }
288 }
289}
290
291impl<A, B> HttpFuture for Either2<A, B>
292where
293 A: HttpFuture,
294 B: HttpFuture,
295{
296 type Body = Either2<A::Body, B::Body>;
297
298 fn poll_http(&mut self) -> Poll<http::Response<Self::Body>, ::Error> {
299 use self::Either2::*;
300
301 match *self {
302 A(ref mut f) => Ok(try_ready!(f.poll_http()).map(A).into()),
303 B(ref mut f) => Ok(try_ready!(f.poll_http()).map(B).into()),
304 }
305 }
306}
307
308impl<A, B> SealedFuture for Either2<A, B>
309where
310 A: HttpFuture,
311 B: HttpFuture,
312{
313}
314
315impl<A, B> Stream for Either2<A, B>
316where
317 A: Stream,
318 B: Stream<Error = A::Error>,
319{
320 type Item = Either2<A::Item, B::Item>;
321 type Error = A::Error;
322
323 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
324 use self::Either2::*;
325
326 match *self {
327 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
328 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
329 }
330 }
331}
332
333impl<A, B> BufStream for Either2<A, B>
334where
335 A: BufStream,
336 B: BufStream<Error = A::Error>,
337{
338 type Item = Either2<A::Item, B::Item>;
339 type Error = A::Error;
340
341 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
342 use self::Either2::*;
343
344 match *self {
345 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
346 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
347 }
348 }
349}
350
351impl<A, B> Buf for Either2<A, B>
352where
353 A: Buf,
354 B: Buf,
355{
356 fn remaining(&self) -> usize {
357 use self::Either2::*;
358
359 match *self {
360 A(ref b) => b.remaining(),
361 B(ref b) => b.remaining(),
362 }
363 }
364
365 fn bytes(&self) -> &[u8] {
366 use self::Either2::*;
367
368 match *self {
369 A(ref b) => b.bytes(),
370 B(ref b) => b.bytes(),
371 }
372 }
373
374 fn advance(&mut self, cnt: usize) {
375 use self::Either2::*;
376
377 match *self {
378 A(ref mut b) => b.advance(cnt),
379 B(ref mut b) => b.advance(cnt),
380 }
381 }
382}
383
384impl<A, B> Response for Either2<A, B>
385where
386 A: Response,
387 B: Response,
388{
389 type Buf = Either2<A::Buf, B::Buf>;
390 type Body = Either2<A::Body, B::Body>;
391
392 fn into_http<S>(self, context: &Context<S>) -> Result<http::Response<Self::Body>, ::Error>
393 where S: Serializer
394 {
395 use self::Either2::*;
396
397 match self {
398 A(r) => Ok(r.into_http(context)?.map(Either2::A)),
399 B(r) => Ok(r.into_http(context)?.map(Either2::B)),
400 }
401 }
402}
403
404impl<R0, R1> Resource for (R0, R1,)
405where
406 R0: Resource,
407 R1: Resource<RequestBody = R0::RequestBody>,
408{
409 type Destination = Either2<R0::Destination, R1::Destination>;
410 type RequestBody = R0::RequestBody;
411 type Buf = Either2<R0::Buf, R1::Buf>;
412 type Body = Either2<R0::Body, R1::Body>;
413 type Future = Either2<R0::Future, R1::Future>;
414
415 fn dispatch(&mut self,
416 destination: Self::Destination,
417 route_match: &RouteMatch,
418 body: Self::RequestBody)
419 -> Self::Future
420 {
421 use self::Either2::*;
422
423 match destination {
424 A(d) => {
425 A(self.0.dispatch(d, route_match, body))
426 }
427 B(d) => {
428 B(self.1.dispatch(d, route_match, body))
429 }
430 }
431 }
432}
433#[derive(Debug, Clone)]
436pub enum Either3<A, B, C> {
437 A(A),
438 B(B),
439 C(C),
440}
441
442impl<A, B, C> Future for Either3<A, B, C>
443where
444 A: Future,
445 B: Future<Error = A::Error>,
446 C: Future<Error = A::Error>,
447{
448 type Item = Either3<A::Item, B::Item, C::Item>;
449 type Error = A::Error;
450
451 fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
452 use self::Either3::*;
453
454 match *self {
455 A(ref mut f) => Ok(A(try_ready!(f.poll())).into()),
456 B(ref mut f) => Ok(B(try_ready!(f.poll())).into()),
457 C(ref mut f) => Ok(C(try_ready!(f.poll())).into()),
458 }
459 }
460}
461
462impl<A, B, C> ResourceFuture for Either3<A, B, C>
463where
464 A: ResourceFuture,
465 B: ResourceFuture,
466 C: ResourceFuture,
467{
468 type Body = Either3<A::Body, B::Body, C::Body>;
469
470 fn poll_response(&mut self, request: &http::Request<()>) -> Poll<http::Response<Self::Body>, ::Error> {
471 use self::Either3::*;
472
473 let response = match *self {
474 A(ref mut f) => try_ready!(f.poll_response(request)).map(A),
475 B(ref mut f) => try_ready!(f.poll_response(request)).map(B),
476 C(ref mut f) => try_ready!(f.poll_response(request)).map(C),
477 };
478 Ok(response.into())
479 }
480}
481
482impl<A, B, C> Either3<A, B, C>
483where
484 A: ExtractFuture,
485 B: ExtractFuture,
486 C: ExtractFuture,
487{
488
489 pub fn poll_ready(&mut self) -> Poll<(), extract::Error> {
490 use self::Either3::*;
491
492 match *self {
493 A(ref mut f) => f.poll(),
494 B(ref mut f) => f.poll(),
495 C(ref mut f) => f.poll(),
496 }
497 }
498}
499
500impl<A, B, C> HttpFuture for Either3<A, B, C>
501where
502 A: HttpFuture,
503 B: HttpFuture,
504 C: HttpFuture,
505{
506 type Body = Either3<A::Body, B::Body, C::Body>;
507
508 fn poll_http(&mut self) -> Poll<http::Response<Self::Body>, ::Error> {
509 use self::Either3::*;
510
511 match *self {
512 A(ref mut f) => Ok(try_ready!(f.poll_http()).map(A).into()),
513 B(ref mut f) => Ok(try_ready!(f.poll_http()).map(B).into()),
514 C(ref mut f) => Ok(try_ready!(f.poll_http()).map(C).into()),
515 }
516 }
517}
518
519impl<A, B, C> SealedFuture for Either3<A, B, C>
520where
521 A: HttpFuture,
522 B: HttpFuture,
523 C: HttpFuture,
524{
525}
526
527impl<A, B, C> Stream for Either3<A, B, C>
528where
529 A: Stream,
530 B: Stream<Error = A::Error>,
531 C: Stream<Error = A::Error>,
532{
533 type Item = Either3<A::Item, B::Item, C::Item>;
534 type Error = A::Error;
535
536 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
537 use self::Either3::*;
538
539 match *self {
540 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
541 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
542 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
543 }
544 }
545}
546
547impl<A, B, C> BufStream for Either3<A, B, C>
548where
549 A: BufStream,
550 B: BufStream<Error = A::Error>,
551 C: BufStream<Error = A::Error>,
552{
553 type Item = Either3<A::Item, B::Item, C::Item>;
554 type Error = A::Error;
555
556 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
557 use self::Either3::*;
558
559 match *self {
560 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
561 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
562 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
563 }
564 }
565}
566
567impl<A, B, C> Buf for Either3<A, B, C>
568where
569 A: Buf,
570 B: Buf,
571 C: Buf,
572{
573 fn remaining(&self) -> usize {
574 use self::Either3::*;
575
576 match *self {
577 A(ref b) => b.remaining(),
578 B(ref b) => b.remaining(),
579 C(ref b) => b.remaining(),
580 }
581 }
582
583 fn bytes(&self) -> &[u8] {
584 use self::Either3::*;
585
586 match *self {
587 A(ref b) => b.bytes(),
588 B(ref b) => b.bytes(),
589 C(ref b) => b.bytes(),
590 }
591 }
592
593 fn advance(&mut self, cnt: usize) {
594 use self::Either3::*;
595
596 match *self {
597 A(ref mut b) => b.advance(cnt),
598 B(ref mut b) => b.advance(cnt),
599 C(ref mut b) => b.advance(cnt),
600 }
601 }
602}
603
604impl<A, B, C> Response for Either3<A, B, C>
605where
606 A: Response,
607 B: Response,
608 C: Response,
609{
610 type Buf = Either3<A::Buf, B::Buf, C::Buf>;
611 type Body = Either3<A::Body, B::Body, C::Body>;
612
613 fn into_http<S>(self, context: &Context<S>) -> Result<http::Response<Self::Body>, ::Error>
614 where S: Serializer
615 {
616 use self::Either3::*;
617
618 match self {
619 A(r) => Ok(r.into_http(context)?.map(Either3::A)),
620 B(r) => Ok(r.into_http(context)?.map(Either3::B)),
621 C(r) => Ok(r.into_http(context)?.map(Either3::C)),
622 }
623 }
624}
625
626impl<R0, R1, R2> Resource for (R0, R1, R2,)
627where
628 R0: Resource,
629 R1: Resource<RequestBody = R0::RequestBody>,
630 R2: Resource<RequestBody = R0::RequestBody>,
631{
632 type Destination = Either3<R0::Destination, R1::Destination, R2::Destination>;
633 type RequestBody = R0::RequestBody;
634 type Buf = Either3<R0::Buf, R1::Buf, R2::Buf>;
635 type Body = Either3<R0::Body, R1::Body, R2::Body>;
636 type Future = Either3<R0::Future, R1::Future, R2::Future>;
637
638 fn dispatch(&mut self,
639 destination: Self::Destination,
640 route_match: &RouteMatch,
641 body: Self::RequestBody)
642 -> Self::Future
643 {
644 use self::Either3::*;
645
646 match destination {
647 A(d) => {
648 A(self.0.dispatch(d, route_match, body))
649 }
650 B(d) => {
651 B(self.1.dispatch(d, route_match, body))
652 }
653 C(d) => {
654 C(self.2.dispatch(d, route_match, body))
655 }
656 }
657 }
658}
659#[derive(Debug, Clone)]
662pub enum Either4<A, B, C, D> {
663 A(A),
664 B(B),
665 C(C),
666 D(D),
667}
668
669impl<A, B, C, D> Future for Either4<A, B, C, D>
670where
671 A: Future,
672 B: Future<Error = A::Error>,
673 C: Future<Error = A::Error>,
674 D: Future<Error = A::Error>,
675{
676 type Item = Either4<A::Item, B::Item, C::Item, D::Item>;
677 type Error = A::Error;
678
679 fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
680 use self::Either4::*;
681
682 match *self {
683 A(ref mut f) => Ok(A(try_ready!(f.poll())).into()),
684 B(ref mut f) => Ok(B(try_ready!(f.poll())).into()),
685 C(ref mut f) => Ok(C(try_ready!(f.poll())).into()),
686 D(ref mut f) => Ok(D(try_ready!(f.poll())).into()),
687 }
688 }
689}
690
691impl<A, B, C, D> ResourceFuture for Either4<A, B, C, D>
692where
693 A: ResourceFuture,
694 B: ResourceFuture,
695 C: ResourceFuture,
696 D: ResourceFuture,
697{
698 type Body = Either4<A::Body, B::Body, C::Body, D::Body>;
699
700 fn poll_response(&mut self, request: &http::Request<()>) -> Poll<http::Response<Self::Body>, ::Error> {
701 use self::Either4::*;
702
703 let response = match *self {
704 A(ref mut f) => try_ready!(f.poll_response(request)).map(A),
705 B(ref mut f) => try_ready!(f.poll_response(request)).map(B),
706 C(ref mut f) => try_ready!(f.poll_response(request)).map(C),
707 D(ref mut f) => try_ready!(f.poll_response(request)).map(D),
708 };
709 Ok(response.into())
710 }
711}
712
713impl<A, B, C, D> Either4<A, B, C, D>
714where
715 A: ExtractFuture,
716 B: ExtractFuture,
717 C: ExtractFuture,
718 D: ExtractFuture,
719{
720
721 pub fn poll_ready(&mut self) -> Poll<(), extract::Error> {
722 use self::Either4::*;
723
724 match *self {
725 A(ref mut f) => f.poll(),
726 B(ref mut f) => f.poll(),
727 C(ref mut f) => f.poll(),
728 D(ref mut f) => f.poll(),
729 }
730 }
731}
732
733impl<A, B, C, D> HttpFuture for Either4<A, B, C, D>
734where
735 A: HttpFuture,
736 B: HttpFuture,
737 C: HttpFuture,
738 D: HttpFuture,
739{
740 type Body = Either4<A::Body, B::Body, C::Body, D::Body>;
741
742 fn poll_http(&mut self) -> Poll<http::Response<Self::Body>, ::Error> {
743 use self::Either4::*;
744
745 match *self {
746 A(ref mut f) => Ok(try_ready!(f.poll_http()).map(A).into()),
747 B(ref mut f) => Ok(try_ready!(f.poll_http()).map(B).into()),
748 C(ref mut f) => Ok(try_ready!(f.poll_http()).map(C).into()),
749 D(ref mut f) => Ok(try_ready!(f.poll_http()).map(D).into()),
750 }
751 }
752}
753
754impl<A, B, C, D> SealedFuture for Either4<A, B, C, D>
755where
756 A: HttpFuture,
757 B: HttpFuture,
758 C: HttpFuture,
759 D: HttpFuture,
760{
761}
762
763impl<A, B, C, D> Stream for Either4<A, B, C, D>
764where
765 A: Stream,
766 B: Stream<Error = A::Error>,
767 C: Stream<Error = A::Error>,
768 D: Stream<Error = A::Error>,
769{
770 type Item = Either4<A::Item, B::Item, C::Item, D::Item>;
771 type Error = A::Error;
772
773 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
774 use self::Either4::*;
775
776 match *self {
777 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
778 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
779 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
780 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
781 }
782 }
783}
784
785impl<A, B, C, D> BufStream for Either4<A, B, C, D>
786where
787 A: BufStream,
788 B: BufStream<Error = A::Error>,
789 C: BufStream<Error = A::Error>,
790 D: BufStream<Error = A::Error>,
791{
792 type Item = Either4<A::Item, B::Item, C::Item, D::Item>;
793 type Error = A::Error;
794
795 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
796 use self::Either4::*;
797
798 match *self {
799 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
800 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
801 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
802 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
803 }
804 }
805}
806
807impl<A, B, C, D> Buf for Either4<A, B, C, D>
808where
809 A: Buf,
810 B: Buf,
811 C: Buf,
812 D: Buf,
813{
814 fn remaining(&self) -> usize {
815 use self::Either4::*;
816
817 match *self {
818 A(ref b) => b.remaining(),
819 B(ref b) => b.remaining(),
820 C(ref b) => b.remaining(),
821 D(ref b) => b.remaining(),
822 }
823 }
824
825 fn bytes(&self) -> &[u8] {
826 use self::Either4::*;
827
828 match *self {
829 A(ref b) => b.bytes(),
830 B(ref b) => b.bytes(),
831 C(ref b) => b.bytes(),
832 D(ref b) => b.bytes(),
833 }
834 }
835
836 fn advance(&mut self, cnt: usize) {
837 use self::Either4::*;
838
839 match *self {
840 A(ref mut b) => b.advance(cnt),
841 B(ref mut b) => b.advance(cnt),
842 C(ref mut b) => b.advance(cnt),
843 D(ref mut b) => b.advance(cnt),
844 }
845 }
846}
847
848impl<A, B, C, D> Response for Either4<A, B, C, D>
849where
850 A: Response,
851 B: Response,
852 C: Response,
853 D: Response,
854{
855 type Buf = Either4<A::Buf, B::Buf, C::Buf, D::Buf>;
856 type Body = Either4<A::Body, B::Body, C::Body, D::Body>;
857
858 fn into_http<S>(self, context: &Context<S>) -> Result<http::Response<Self::Body>, ::Error>
859 where S: Serializer
860 {
861 use self::Either4::*;
862
863 match self {
864 A(r) => Ok(r.into_http(context)?.map(Either4::A)),
865 B(r) => Ok(r.into_http(context)?.map(Either4::B)),
866 C(r) => Ok(r.into_http(context)?.map(Either4::C)),
867 D(r) => Ok(r.into_http(context)?.map(Either4::D)),
868 }
869 }
870}
871
872impl<R0, R1, R2, R3> Resource for (R0, R1, R2, R3,)
873where
874 R0: Resource,
875 R1: Resource<RequestBody = R0::RequestBody>,
876 R2: Resource<RequestBody = R0::RequestBody>,
877 R3: Resource<RequestBody = R0::RequestBody>,
878{
879 type Destination = Either4<R0::Destination, R1::Destination, R2::Destination, R3::Destination>;
880 type RequestBody = R0::RequestBody;
881 type Buf = Either4<R0::Buf, R1::Buf, R2::Buf, R3::Buf>;
882 type Body = Either4<R0::Body, R1::Body, R2::Body, R3::Body>;
883 type Future = Either4<R0::Future, R1::Future, R2::Future, R3::Future>;
884
885 fn dispatch(&mut self,
886 destination: Self::Destination,
887 route_match: &RouteMatch,
888 body: Self::RequestBody)
889 -> Self::Future
890 {
891 use self::Either4::*;
892
893 match destination {
894 A(d) => {
895 A(self.0.dispatch(d, route_match, body))
896 }
897 B(d) => {
898 B(self.1.dispatch(d, route_match, body))
899 }
900 C(d) => {
901 C(self.2.dispatch(d, route_match, body))
902 }
903 D(d) => {
904 D(self.3.dispatch(d, route_match, body))
905 }
906 }
907 }
908}
909#[derive(Debug, Clone)]
912pub enum Either5<A, B, C, D, E> {
913 A(A),
914 B(B),
915 C(C),
916 D(D),
917 E(E),
918}
919
920impl<A, B, C, D, E> Future for Either5<A, B, C, D, E>
921where
922 A: Future,
923 B: Future<Error = A::Error>,
924 C: Future<Error = A::Error>,
925 D: Future<Error = A::Error>,
926 E: Future<Error = A::Error>,
927{
928 type Item = Either5<A::Item, B::Item, C::Item, D::Item, E::Item>;
929 type Error = A::Error;
930
931 fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
932 use self::Either5::*;
933
934 match *self {
935 A(ref mut f) => Ok(A(try_ready!(f.poll())).into()),
936 B(ref mut f) => Ok(B(try_ready!(f.poll())).into()),
937 C(ref mut f) => Ok(C(try_ready!(f.poll())).into()),
938 D(ref mut f) => Ok(D(try_ready!(f.poll())).into()),
939 E(ref mut f) => Ok(E(try_ready!(f.poll())).into()),
940 }
941 }
942}
943
944impl<A, B, C, D, E> ResourceFuture for Either5<A, B, C, D, E>
945where
946 A: ResourceFuture,
947 B: ResourceFuture,
948 C: ResourceFuture,
949 D: ResourceFuture,
950 E: ResourceFuture,
951{
952 type Body = Either5<A::Body, B::Body, C::Body, D::Body, E::Body>;
953
954 fn poll_response(&mut self, request: &http::Request<()>) -> Poll<http::Response<Self::Body>, ::Error> {
955 use self::Either5::*;
956
957 let response = match *self {
958 A(ref mut f) => try_ready!(f.poll_response(request)).map(A),
959 B(ref mut f) => try_ready!(f.poll_response(request)).map(B),
960 C(ref mut f) => try_ready!(f.poll_response(request)).map(C),
961 D(ref mut f) => try_ready!(f.poll_response(request)).map(D),
962 E(ref mut f) => try_ready!(f.poll_response(request)).map(E),
963 };
964 Ok(response.into())
965 }
966}
967
968impl<A, B, C, D, E> Either5<A, B, C, D, E>
969where
970 A: ExtractFuture,
971 B: ExtractFuture,
972 C: ExtractFuture,
973 D: ExtractFuture,
974 E: ExtractFuture,
975{
976
977 pub fn poll_ready(&mut self) -> Poll<(), extract::Error> {
978 use self::Either5::*;
979
980 match *self {
981 A(ref mut f) => f.poll(),
982 B(ref mut f) => f.poll(),
983 C(ref mut f) => f.poll(),
984 D(ref mut f) => f.poll(),
985 E(ref mut f) => f.poll(),
986 }
987 }
988}
989
990impl<A, B, C, D, E> HttpFuture for Either5<A, B, C, D, E>
991where
992 A: HttpFuture,
993 B: HttpFuture,
994 C: HttpFuture,
995 D: HttpFuture,
996 E: HttpFuture,
997{
998 type Body = Either5<A::Body, B::Body, C::Body, D::Body, E::Body>;
999
1000 fn poll_http(&mut self) -> Poll<http::Response<Self::Body>, ::Error> {
1001 use self::Either5::*;
1002
1003 match *self {
1004 A(ref mut f) => Ok(try_ready!(f.poll_http()).map(A).into()),
1005 B(ref mut f) => Ok(try_ready!(f.poll_http()).map(B).into()),
1006 C(ref mut f) => Ok(try_ready!(f.poll_http()).map(C).into()),
1007 D(ref mut f) => Ok(try_ready!(f.poll_http()).map(D).into()),
1008 E(ref mut f) => Ok(try_ready!(f.poll_http()).map(E).into()),
1009 }
1010 }
1011}
1012
1013impl<A, B, C, D, E> SealedFuture for Either5<A, B, C, D, E>
1014where
1015 A: HttpFuture,
1016 B: HttpFuture,
1017 C: HttpFuture,
1018 D: HttpFuture,
1019 E: HttpFuture,
1020{
1021}
1022
1023impl<A, B, C, D, E> Stream for Either5<A, B, C, D, E>
1024where
1025 A: Stream,
1026 B: Stream<Error = A::Error>,
1027 C: Stream<Error = A::Error>,
1028 D: Stream<Error = A::Error>,
1029 E: Stream<Error = A::Error>,
1030{
1031 type Item = Either5<A::Item, B::Item, C::Item, D::Item, E::Item>;
1032 type Error = A::Error;
1033
1034 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
1035 use self::Either5::*;
1036
1037 match *self {
1038 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
1039 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
1040 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
1041 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
1042 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
1043 }
1044 }
1045}
1046
1047impl<A, B, C, D, E> BufStream for Either5<A, B, C, D, E>
1048where
1049 A: BufStream,
1050 B: BufStream<Error = A::Error>,
1051 C: BufStream<Error = A::Error>,
1052 D: BufStream<Error = A::Error>,
1053 E: BufStream<Error = A::Error>,
1054{
1055 type Item = Either5<A::Item, B::Item, C::Item, D::Item, E::Item>;
1056 type Error = A::Error;
1057
1058 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
1059 use self::Either5::*;
1060
1061 match *self {
1062 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
1063 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
1064 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
1065 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
1066 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
1067 }
1068 }
1069}
1070
1071impl<A, B, C, D, E> Buf for Either5<A, B, C, D, E>
1072where
1073 A: Buf,
1074 B: Buf,
1075 C: Buf,
1076 D: Buf,
1077 E: Buf,
1078{
1079 fn remaining(&self) -> usize {
1080 use self::Either5::*;
1081
1082 match *self {
1083 A(ref b) => b.remaining(),
1084 B(ref b) => b.remaining(),
1085 C(ref b) => b.remaining(),
1086 D(ref b) => b.remaining(),
1087 E(ref b) => b.remaining(),
1088 }
1089 }
1090
1091 fn bytes(&self) -> &[u8] {
1092 use self::Either5::*;
1093
1094 match *self {
1095 A(ref b) => b.bytes(),
1096 B(ref b) => b.bytes(),
1097 C(ref b) => b.bytes(),
1098 D(ref b) => b.bytes(),
1099 E(ref b) => b.bytes(),
1100 }
1101 }
1102
1103 fn advance(&mut self, cnt: usize) {
1104 use self::Either5::*;
1105
1106 match *self {
1107 A(ref mut b) => b.advance(cnt),
1108 B(ref mut b) => b.advance(cnt),
1109 C(ref mut b) => b.advance(cnt),
1110 D(ref mut b) => b.advance(cnt),
1111 E(ref mut b) => b.advance(cnt),
1112 }
1113 }
1114}
1115
1116impl<A, B, C, D, E> Response for Either5<A, B, C, D, E>
1117where
1118 A: Response,
1119 B: Response,
1120 C: Response,
1121 D: Response,
1122 E: Response,
1123{
1124 type Buf = Either5<A::Buf, B::Buf, C::Buf, D::Buf, E::Buf>;
1125 type Body = Either5<A::Body, B::Body, C::Body, D::Body, E::Body>;
1126
1127 fn into_http<S>(self, context: &Context<S>) -> Result<http::Response<Self::Body>, ::Error>
1128 where S: Serializer
1129 {
1130 use self::Either5::*;
1131
1132 match self {
1133 A(r) => Ok(r.into_http(context)?.map(Either5::A)),
1134 B(r) => Ok(r.into_http(context)?.map(Either5::B)),
1135 C(r) => Ok(r.into_http(context)?.map(Either5::C)),
1136 D(r) => Ok(r.into_http(context)?.map(Either5::D)),
1137 E(r) => Ok(r.into_http(context)?.map(Either5::E)),
1138 }
1139 }
1140}
1141
1142impl<R0, R1, R2, R3, R4> Resource for (R0, R1, R2, R3, R4,)
1143where
1144 R0: Resource,
1145 R1: Resource<RequestBody = R0::RequestBody>,
1146 R2: Resource<RequestBody = R0::RequestBody>,
1147 R3: Resource<RequestBody = R0::RequestBody>,
1148 R4: Resource<RequestBody = R0::RequestBody>,
1149{
1150 type Destination = Either5<R0::Destination, R1::Destination, R2::Destination, R3::Destination, R4::Destination>;
1151 type RequestBody = R0::RequestBody;
1152 type Buf = Either5<R0::Buf, R1::Buf, R2::Buf, R3::Buf, R4::Buf>;
1153 type Body = Either5<R0::Body, R1::Body, R2::Body, R3::Body, R4::Body>;
1154 type Future = Either5<R0::Future, R1::Future, R2::Future, R3::Future, R4::Future>;
1155
1156 fn dispatch(&mut self,
1157 destination: Self::Destination,
1158 route_match: &RouteMatch,
1159 body: Self::RequestBody)
1160 -> Self::Future
1161 {
1162 use self::Either5::*;
1163
1164 match destination {
1165 A(d) => {
1166 A(self.0.dispatch(d, route_match, body))
1167 }
1168 B(d) => {
1169 B(self.1.dispatch(d, route_match, body))
1170 }
1171 C(d) => {
1172 C(self.2.dispatch(d, route_match, body))
1173 }
1174 D(d) => {
1175 D(self.3.dispatch(d, route_match, body))
1176 }
1177 E(d) => {
1178 E(self.4.dispatch(d, route_match, body))
1179 }
1180 }
1181 }
1182}
1183#[derive(Debug, Clone)]
1186pub enum Either6<A, B, C, D, E, F> {
1187 A(A),
1188 B(B),
1189 C(C),
1190 D(D),
1191 E(E),
1192 F(F),
1193}
1194
1195impl<A, B, C, D, E, F> Future for Either6<A, B, C, D, E, F>
1196where
1197 A: Future,
1198 B: Future<Error = A::Error>,
1199 C: Future<Error = A::Error>,
1200 D: Future<Error = A::Error>,
1201 E: Future<Error = A::Error>,
1202 F: Future<Error = A::Error>,
1203{
1204 type Item = Either6<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item>;
1205 type Error = A::Error;
1206
1207 fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
1208 use self::Either6::*;
1209
1210 match *self {
1211 A(ref mut f) => Ok(A(try_ready!(f.poll())).into()),
1212 B(ref mut f) => Ok(B(try_ready!(f.poll())).into()),
1213 C(ref mut f) => Ok(C(try_ready!(f.poll())).into()),
1214 D(ref mut f) => Ok(D(try_ready!(f.poll())).into()),
1215 E(ref mut f) => Ok(E(try_ready!(f.poll())).into()),
1216 F(ref mut f) => Ok(F(try_ready!(f.poll())).into()),
1217 }
1218 }
1219}
1220
1221impl<A, B, C, D, E, F> ResourceFuture for Either6<A, B, C, D, E, F>
1222where
1223 A: ResourceFuture,
1224 B: ResourceFuture,
1225 C: ResourceFuture,
1226 D: ResourceFuture,
1227 E: ResourceFuture,
1228 F: ResourceFuture,
1229{
1230 type Body = Either6<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body>;
1231
1232 fn poll_response(&mut self, request: &http::Request<()>) -> Poll<http::Response<Self::Body>, ::Error> {
1233 use self::Either6::*;
1234
1235 let response = match *self {
1236 A(ref mut f) => try_ready!(f.poll_response(request)).map(A),
1237 B(ref mut f) => try_ready!(f.poll_response(request)).map(B),
1238 C(ref mut f) => try_ready!(f.poll_response(request)).map(C),
1239 D(ref mut f) => try_ready!(f.poll_response(request)).map(D),
1240 E(ref mut f) => try_ready!(f.poll_response(request)).map(E),
1241 F(ref mut f) => try_ready!(f.poll_response(request)).map(F),
1242 };
1243 Ok(response.into())
1244 }
1245}
1246
1247impl<A, B, C, D, E, F> Either6<A, B, C, D, E, F>
1248where
1249 A: ExtractFuture,
1250 B: ExtractFuture,
1251 C: ExtractFuture,
1252 D: ExtractFuture,
1253 E: ExtractFuture,
1254 F: ExtractFuture,
1255{
1256
1257 pub fn poll_ready(&mut self) -> Poll<(), extract::Error> {
1258 use self::Either6::*;
1259
1260 match *self {
1261 A(ref mut f) => f.poll(),
1262 B(ref mut f) => f.poll(),
1263 C(ref mut f) => f.poll(),
1264 D(ref mut f) => f.poll(),
1265 E(ref mut f) => f.poll(),
1266 F(ref mut f) => f.poll(),
1267 }
1268 }
1269}
1270
1271impl<A, B, C, D, E, F> HttpFuture for Either6<A, B, C, D, E, F>
1272where
1273 A: HttpFuture,
1274 B: HttpFuture,
1275 C: HttpFuture,
1276 D: HttpFuture,
1277 E: HttpFuture,
1278 F: HttpFuture,
1279{
1280 type Body = Either6<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body>;
1281
1282 fn poll_http(&mut self) -> Poll<http::Response<Self::Body>, ::Error> {
1283 use self::Either6::*;
1284
1285 match *self {
1286 A(ref mut f) => Ok(try_ready!(f.poll_http()).map(A).into()),
1287 B(ref mut f) => Ok(try_ready!(f.poll_http()).map(B).into()),
1288 C(ref mut f) => Ok(try_ready!(f.poll_http()).map(C).into()),
1289 D(ref mut f) => Ok(try_ready!(f.poll_http()).map(D).into()),
1290 E(ref mut f) => Ok(try_ready!(f.poll_http()).map(E).into()),
1291 F(ref mut f) => Ok(try_ready!(f.poll_http()).map(F).into()),
1292 }
1293 }
1294}
1295
1296impl<A, B, C, D, E, F> SealedFuture for Either6<A, B, C, D, E, F>
1297where
1298 A: HttpFuture,
1299 B: HttpFuture,
1300 C: HttpFuture,
1301 D: HttpFuture,
1302 E: HttpFuture,
1303 F: HttpFuture,
1304{
1305}
1306
1307impl<A, B, C, D, E, F> Stream for Either6<A, B, C, D, E, F>
1308where
1309 A: Stream,
1310 B: Stream<Error = A::Error>,
1311 C: Stream<Error = A::Error>,
1312 D: Stream<Error = A::Error>,
1313 E: Stream<Error = A::Error>,
1314 F: Stream<Error = A::Error>,
1315{
1316 type Item = Either6<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item>;
1317 type Error = A::Error;
1318
1319 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
1320 use self::Either6::*;
1321
1322 match *self {
1323 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
1324 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
1325 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
1326 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
1327 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
1328 F(ref mut f) => Ok(try_ready!(f.poll()).map(F).into()),
1329 }
1330 }
1331}
1332
1333impl<A, B, C, D, E, F> BufStream for Either6<A, B, C, D, E, F>
1334where
1335 A: BufStream,
1336 B: BufStream<Error = A::Error>,
1337 C: BufStream<Error = A::Error>,
1338 D: BufStream<Error = A::Error>,
1339 E: BufStream<Error = A::Error>,
1340 F: BufStream<Error = A::Error>,
1341{
1342 type Item = Either6<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item>;
1343 type Error = A::Error;
1344
1345 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
1346 use self::Either6::*;
1347
1348 match *self {
1349 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
1350 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
1351 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
1352 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
1353 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
1354 F(ref mut f) => Ok(try_ready!(f.poll()).map(F).into()),
1355 }
1356 }
1357}
1358
1359impl<A, B, C, D, E, F> Buf for Either6<A, B, C, D, E, F>
1360where
1361 A: Buf,
1362 B: Buf,
1363 C: Buf,
1364 D: Buf,
1365 E: Buf,
1366 F: Buf,
1367{
1368 fn remaining(&self) -> usize {
1369 use self::Either6::*;
1370
1371 match *self {
1372 A(ref b) => b.remaining(),
1373 B(ref b) => b.remaining(),
1374 C(ref b) => b.remaining(),
1375 D(ref b) => b.remaining(),
1376 E(ref b) => b.remaining(),
1377 F(ref b) => b.remaining(),
1378 }
1379 }
1380
1381 fn bytes(&self) -> &[u8] {
1382 use self::Either6::*;
1383
1384 match *self {
1385 A(ref b) => b.bytes(),
1386 B(ref b) => b.bytes(),
1387 C(ref b) => b.bytes(),
1388 D(ref b) => b.bytes(),
1389 E(ref b) => b.bytes(),
1390 F(ref b) => b.bytes(),
1391 }
1392 }
1393
1394 fn advance(&mut self, cnt: usize) {
1395 use self::Either6::*;
1396
1397 match *self {
1398 A(ref mut b) => b.advance(cnt),
1399 B(ref mut b) => b.advance(cnt),
1400 C(ref mut b) => b.advance(cnt),
1401 D(ref mut b) => b.advance(cnt),
1402 E(ref mut b) => b.advance(cnt),
1403 F(ref mut b) => b.advance(cnt),
1404 }
1405 }
1406}
1407
1408impl<A, B, C, D, E, F> Response for Either6<A, B, C, D, E, F>
1409where
1410 A: Response,
1411 B: Response,
1412 C: Response,
1413 D: Response,
1414 E: Response,
1415 F: Response,
1416{
1417 type Buf = Either6<A::Buf, B::Buf, C::Buf, D::Buf, E::Buf, F::Buf>;
1418 type Body = Either6<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body>;
1419
1420 fn into_http<S>(self, context: &Context<S>) -> Result<http::Response<Self::Body>, ::Error>
1421 where S: Serializer
1422 {
1423 use self::Either6::*;
1424
1425 match self {
1426 A(r) => Ok(r.into_http(context)?.map(Either6::A)),
1427 B(r) => Ok(r.into_http(context)?.map(Either6::B)),
1428 C(r) => Ok(r.into_http(context)?.map(Either6::C)),
1429 D(r) => Ok(r.into_http(context)?.map(Either6::D)),
1430 E(r) => Ok(r.into_http(context)?.map(Either6::E)),
1431 F(r) => Ok(r.into_http(context)?.map(Either6::F)),
1432 }
1433 }
1434}
1435
1436impl<R0, R1, R2, R3, R4, R5> Resource for (R0, R1, R2, R3, R4, R5,)
1437where
1438 R0: Resource,
1439 R1: Resource<RequestBody = R0::RequestBody>,
1440 R2: Resource<RequestBody = R0::RequestBody>,
1441 R3: Resource<RequestBody = R0::RequestBody>,
1442 R4: Resource<RequestBody = R0::RequestBody>,
1443 R5: Resource<RequestBody = R0::RequestBody>,
1444{
1445 type Destination = Either6<R0::Destination, R1::Destination, R2::Destination, R3::Destination, R4::Destination, R5::Destination>;
1446 type RequestBody = R0::RequestBody;
1447 type Buf = Either6<R0::Buf, R1::Buf, R2::Buf, R3::Buf, R4::Buf, R5::Buf>;
1448 type Body = Either6<R0::Body, R1::Body, R2::Body, R3::Body, R4::Body, R5::Body>;
1449 type Future = Either6<R0::Future, R1::Future, R2::Future, R3::Future, R4::Future, R5::Future>;
1450
1451 fn dispatch(&mut self,
1452 destination: Self::Destination,
1453 route_match: &RouteMatch,
1454 body: Self::RequestBody)
1455 -> Self::Future
1456 {
1457 use self::Either6::*;
1458
1459 match destination {
1460 A(d) => {
1461 A(self.0.dispatch(d, route_match, body))
1462 }
1463 B(d) => {
1464 B(self.1.dispatch(d, route_match, body))
1465 }
1466 C(d) => {
1467 C(self.2.dispatch(d, route_match, body))
1468 }
1469 D(d) => {
1470 D(self.3.dispatch(d, route_match, body))
1471 }
1472 E(d) => {
1473 E(self.4.dispatch(d, route_match, body))
1474 }
1475 F(d) => {
1476 F(self.5.dispatch(d, route_match, body))
1477 }
1478 }
1479 }
1480}
1481#[derive(Debug, Clone)]
1484pub enum Either7<A, B, C, D, E, F, G> {
1485 A(A),
1486 B(B),
1487 C(C),
1488 D(D),
1489 E(E),
1490 F(F),
1491 G(G),
1492}
1493
1494impl<A, B, C, D, E, F, G> Future for Either7<A, B, C, D, E, F, G>
1495where
1496 A: Future,
1497 B: Future<Error = A::Error>,
1498 C: Future<Error = A::Error>,
1499 D: Future<Error = A::Error>,
1500 E: Future<Error = A::Error>,
1501 F: Future<Error = A::Error>,
1502 G: Future<Error = A::Error>,
1503{
1504 type Item = Either7<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item>;
1505 type Error = A::Error;
1506
1507 fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
1508 use self::Either7::*;
1509
1510 match *self {
1511 A(ref mut f) => Ok(A(try_ready!(f.poll())).into()),
1512 B(ref mut f) => Ok(B(try_ready!(f.poll())).into()),
1513 C(ref mut f) => Ok(C(try_ready!(f.poll())).into()),
1514 D(ref mut f) => Ok(D(try_ready!(f.poll())).into()),
1515 E(ref mut f) => Ok(E(try_ready!(f.poll())).into()),
1516 F(ref mut f) => Ok(F(try_ready!(f.poll())).into()),
1517 G(ref mut f) => Ok(G(try_ready!(f.poll())).into()),
1518 }
1519 }
1520}
1521
1522impl<A, B, C, D, E, F, G> ResourceFuture for Either7<A, B, C, D, E, F, G>
1523where
1524 A: ResourceFuture,
1525 B: ResourceFuture,
1526 C: ResourceFuture,
1527 D: ResourceFuture,
1528 E: ResourceFuture,
1529 F: ResourceFuture,
1530 G: ResourceFuture,
1531{
1532 type Body = Either7<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body>;
1533
1534 fn poll_response(&mut self, request: &http::Request<()>) -> Poll<http::Response<Self::Body>, ::Error> {
1535 use self::Either7::*;
1536
1537 let response = match *self {
1538 A(ref mut f) => try_ready!(f.poll_response(request)).map(A),
1539 B(ref mut f) => try_ready!(f.poll_response(request)).map(B),
1540 C(ref mut f) => try_ready!(f.poll_response(request)).map(C),
1541 D(ref mut f) => try_ready!(f.poll_response(request)).map(D),
1542 E(ref mut f) => try_ready!(f.poll_response(request)).map(E),
1543 F(ref mut f) => try_ready!(f.poll_response(request)).map(F),
1544 G(ref mut f) => try_ready!(f.poll_response(request)).map(G),
1545 };
1546 Ok(response.into())
1547 }
1548}
1549
1550impl<A, B, C, D, E, F, G> Either7<A, B, C, D, E, F, G>
1551where
1552 A: ExtractFuture,
1553 B: ExtractFuture,
1554 C: ExtractFuture,
1555 D: ExtractFuture,
1556 E: ExtractFuture,
1557 F: ExtractFuture,
1558 G: ExtractFuture,
1559{
1560
1561 pub fn poll_ready(&mut self) -> Poll<(), extract::Error> {
1562 use self::Either7::*;
1563
1564 match *self {
1565 A(ref mut f) => f.poll(),
1566 B(ref mut f) => f.poll(),
1567 C(ref mut f) => f.poll(),
1568 D(ref mut f) => f.poll(),
1569 E(ref mut f) => f.poll(),
1570 F(ref mut f) => f.poll(),
1571 G(ref mut f) => f.poll(),
1572 }
1573 }
1574}
1575
1576impl<A, B, C, D, E, F, G> HttpFuture for Either7<A, B, C, D, E, F, G>
1577where
1578 A: HttpFuture,
1579 B: HttpFuture,
1580 C: HttpFuture,
1581 D: HttpFuture,
1582 E: HttpFuture,
1583 F: HttpFuture,
1584 G: HttpFuture,
1585{
1586 type Body = Either7<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body>;
1587
1588 fn poll_http(&mut self) -> Poll<http::Response<Self::Body>, ::Error> {
1589 use self::Either7::*;
1590
1591 match *self {
1592 A(ref mut f) => Ok(try_ready!(f.poll_http()).map(A).into()),
1593 B(ref mut f) => Ok(try_ready!(f.poll_http()).map(B).into()),
1594 C(ref mut f) => Ok(try_ready!(f.poll_http()).map(C).into()),
1595 D(ref mut f) => Ok(try_ready!(f.poll_http()).map(D).into()),
1596 E(ref mut f) => Ok(try_ready!(f.poll_http()).map(E).into()),
1597 F(ref mut f) => Ok(try_ready!(f.poll_http()).map(F).into()),
1598 G(ref mut f) => Ok(try_ready!(f.poll_http()).map(G).into()),
1599 }
1600 }
1601}
1602
1603impl<A, B, C, D, E, F, G> SealedFuture for Either7<A, B, C, D, E, F, G>
1604where
1605 A: HttpFuture,
1606 B: HttpFuture,
1607 C: HttpFuture,
1608 D: HttpFuture,
1609 E: HttpFuture,
1610 F: HttpFuture,
1611 G: HttpFuture,
1612{
1613}
1614
1615impl<A, B, C, D, E, F, G> Stream for Either7<A, B, C, D, E, F, G>
1616where
1617 A: Stream,
1618 B: Stream<Error = A::Error>,
1619 C: Stream<Error = A::Error>,
1620 D: Stream<Error = A::Error>,
1621 E: Stream<Error = A::Error>,
1622 F: Stream<Error = A::Error>,
1623 G: Stream<Error = A::Error>,
1624{
1625 type Item = Either7<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item>;
1626 type Error = A::Error;
1627
1628 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
1629 use self::Either7::*;
1630
1631 match *self {
1632 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
1633 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
1634 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
1635 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
1636 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
1637 F(ref mut f) => Ok(try_ready!(f.poll()).map(F).into()),
1638 G(ref mut f) => Ok(try_ready!(f.poll()).map(G).into()),
1639 }
1640 }
1641}
1642
1643impl<A, B, C, D, E, F, G> BufStream for Either7<A, B, C, D, E, F, G>
1644where
1645 A: BufStream,
1646 B: BufStream<Error = A::Error>,
1647 C: BufStream<Error = A::Error>,
1648 D: BufStream<Error = A::Error>,
1649 E: BufStream<Error = A::Error>,
1650 F: BufStream<Error = A::Error>,
1651 G: BufStream<Error = A::Error>,
1652{
1653 type Item = Either7<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item>;
1654 type Error = A::Error;
1655
1656 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
1657 use self::Either7::*;
1658
1659 match *self {
1660 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
1661 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
1662 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
1663 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
1664 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
1665 F(ref mut f) => Ok(try_ready!(f.poll()).map(F).into()),
1666 G(ref mut f) => Ok(try_ready!(f.poll()).map(G).into()),
1667 }
1668 }
1669}
1670
1671impl<A, B, C, D, E, F, G> Buf for Either7<A, B, C, D, E, F, G>
1672where
1673 A: Buf,
1674 B: Buf,
1675 C: Buf,
1676 D: Buf,
1677 E: Buf,
1678 F: Buf,
1679 G: Buf,
1680{
1681 fn remaining(&self) -> usize {
1682 use self::Either7::*;
1683
1684 match *self {
1685 A(ref b) => b.remaining(),
1686 B(ref b) => b.remaining(),
1687 C(ref b) => b.remaining(),
1688 D(ref b) => b.remaining(),
1689 E(ref b) => b.remaining(),
1690 F(ref b) => b.remaining(),
1691 G(ref b) => b.remaining(),
1692 }
1693 }
1694
1695 fn bytes(&self) -> &[u8] {
1696 use self::Either7::*;
1697
1698 match *self {
1699 A(ref b) => b.bytes(),
1700 B(ref b) => b.bytes(),
1701 C(ref b) => b.bytes(),
1702 D(ref b) => b.bytes(),
1703 E(ref b) => b.bytes(),
1704 F(ref b) => b.bytes(),
1705 G(ref b) => b.bytes(),
1706 }
1707 }
1708
1709 fn advance(&mut self, cnt: usize) {
1710 use self::Either7::*;
1711
1712 match *self {
1713 A(ref mut b) => b.advance(cnt),
1714 B(ref mut b) => b.advance(cnt),
1715 C(ref mut b) => b.advance(cnt),
1716 D(ref mut b) => b.advance(cnt),
1717 E(ref mut b) => b.advance(cnt),
1718 F(ref mut b) => b.advance(cnt),
1719 G(ref mut b) => b.advance(cnt),
1720 }
1721 }
1722}
1723
1724impl<A, B, C, D, E, F, G> Response for Either7<A, B, C, D, E, F, G>
1725where
1726 A: Response,
1727 B: Response,
1728 C: Response,
1729 D: Response,
1730 E: Response,
1731 F: Response,
1732 G: Response,
1733{
1734 type Buf = Either7<A::Buf, B::Buf, C::Buf, D::Buf, E::Buf, F::Buf, G::Buf>;
1735 type Body = Either7<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body>;
1736
1737 fn into_http<S>(self, context: &Context<S>) -> Result<http::Response<Self::Body>, ::Error>
1738 where S: Serializer
1739 {
1740 use self::Either7::*;
1741
1742 match self {
1743 A(r) => Ok(r.into_http(context)?.map(Either7::A)),
1744 B(r) => Ok(r.into_http(context)?.map(Either7::B)),
1745 C(r) => Ok(r.into_http(context)?.map(Either7::C)),
1746 D(r) => Ok(r.into_http(context)?.map(Either7::D)),
1747 E(r) => Ok(r.into_http(context)?.map(Either7::E)),
1748 F(r) => Ok(r.into_http(context)?.map(Either7::F)),
1749 G(r) => Ok(r.into_http(context)?.map(Either7::G)),
1750 }
1751 }
1752}
1753
1754impl<R0, R1, R2, R3, R4, R5, R6> Resource for (R0, R1, R2, R3, R4, R5, R6,)
1755where
1756 R0: Resource,
1757 R1: Resource<RequestBody = R0::RequestBody>,
1758 R2: Resource<RequestBody = R0::RequestBody>,
1759 R3: Resource<RequestBody = R0::RequestBody>,
1760 R4: Resource<RequestBody = R0::RequestBody>,
1761 R5: Resource<RequestBody = R0::RequestBody>,
1762 R6: Resource<RequestBody = R0::RequestBody>,
1763{
1764 type Destination = Either7<R0::Destination, R1::Destination, R2::Destination, R3::Destination, R4::Destination, R5::Destination, R6::Destination>;
1765 type RequestBody = R0::RequestBody;
1766 type Buf = Either7<R0::Buf, R1::Buf, R2::Buf, R3::Buf, R4::Buf, R5::Buf, R6::Buf>;
1767 type Body = Either7<R0::Body, R1::Body, R2::Body, R3::Body, R4::Body, R5::Body, R6::Body>;
1768 type Future = Either7<R0::Future, R1::Future, R2::Future, R3::Future, R4::Future, R5::Future, R6::Future>;
1769
1770 fn dispatch(&mut self,
1771 destination: Self::Destination,
1772 route_match: &RouteMatch,
1773 body: Self::RequestBody)
1774 -> Self::Future
1775 {
1776 use self::Either7::*;
1777
1778 match destination {
1779 A(d) => {
1780 A(self.0.dispatch(d, route_match, body))
1781 }
1782 B(d) => {
1783 B(self.1.dispatch(d, route_match, body))
1784 }
1785 C(d) => {
1786 C(self.2.dispatch(d, route_match, body))
1787 }
1788 D(d) => {
1789 D(self.3.dispatch(d, route_match, body))
1790 }
1791 E(d) => {
1792 E(self.4.dispatch(d, route_match, body))
1793 }
1794 F(d) => {
1795 F(self.5.dispatch(d, route_match, body))
1796 }
1797 G(d) => {
1798 G(self.6.dispatch(d, route_match, body))
1799 }
1800 }
1801 }
1802}
1803#[derive(Debug, Clone)]
1806pub enum Either8<A, B, C, D, E, F, G, H> {
1807 A(A),
1808 B(B),
1809 C(C),
1810 D(D),
1811 E(E),
1812 F(F),
1813 G(G),
1814 H(H),
1815}
1816
1817impl<A, B, C, D, E, F, G, H> Future for Either8<A, B, C, D, E, F, G, H>
1818where
1819 A: Future,
1820 B: Future<Error = A::Error>,
1821 C: Future<Error = A::Error>,
1822 D: Future<Error = A::Error>,
1823 E: Future<Error = A::Error>,
1824 F: Future<Error = A::Error>,
1825 G: Future<Error = A::Error>,
1826 H: Future<Error = A::Error>,
1827{
1828 type Item = Either8<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item>;
1829 type Error = A::Error;
1830
1831 fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
1832 use self::Either8::*;
1833
1834 match *self {
1835 A(ref mut f) => Ok(A(try_ready!(f.poll())).into()),
1836 B(ref mut f) => Ok(B(try_ready!(f.poll())).into()),
1837 C(ref mut f) => Ok(C(try_ready!(f.poll())).into()),
1838 D(ref mut f) => Ok(D(try_ready!(f.poll())).into()),
1839 E(ref mut f) => Ok(E(try_ready!(f.poll())).into()),
1840 F(ref mut f) => Ok(F(try_ready!(f.poll())).into()),
1841 G(ref mut f) => Ok(G(try_ready!(f.poll())).into()),
1842 H(ref mut f) => Ok(H(try_ready!(f.poll())).into()),
1843 }
1844 }
1845}
1846
1847impl<A, B, C, D, E, F, G, H> ResourceFuture for Either8<A, B, C, D, E, F, G, H>
1848where
1849 A: ResourceFuture,
1850 B: ResourceFuture,
1851 C: ResourceFuture,
1852 D: ResourceFuture,
1853 E: ResourceFuture,
1854 F: ResourceFuture,
1855 G: ResourceFuture,
1856 H: ResourceFuture,
1857{
1858 type Body = Either8<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body>;
1859
1860 fn poll_response(&mut self, request: &http::Request<()>) -> Poll<http::Response<Self::Body>, ::Error> {
1861 use self::Either8::*;
1862
1863 let response = match *self {
1864 A(ref mut f) => try_ready!(f.poll_response(request)).map(A),
1865 B(ref mut f) => try_ready!(f.poll_response(request)).map(B),
1866 C(ref mut f) => try_ready!(f.poll_response(request)).map(C),
1867 D(ref mut f) => try_ready!(f.poll_response(request)).map(D),
1868 E(ref mut f) => try_ready!(f.poll_response(request)).map(E),
1869 F(ref mut f) => try_ready!(f.poll_response(request)).map(F),
1870 G(ref mut f) => try_ready!(f.poll_response(request)).map(G),
1871 H(ref mut f) => try_ready!(f.poll_response(request)).map(H),
1872 };
1873 Ok(response.into())
1874 }
1875}
1876
1877impl<A, B, C, D, E, F, G, H> Either8<A, B, C, D, E, F, G, H>
1878where
1879 A: ExtractFuture,
1880 B: ExtractFuture,
1881 C: ExtractFuture,
1882 D: ExtractFuture,
1883 E: ExtractFuture,
1884 F: ExtractFuture,
1885 G: ExtractFuture,
1886 H: ExtractFuture,
1887{
1888
1889 pub fn poll_ready(&mut self) -> Poll<(), extract::Error> {
1890 use self::Either8::*;
1891
1892 match *self {
1893 A(ref mut f) => f.poll(),
1894 B(ref mut f) => f.poll(),
1895 C(ref mut f) => f.poll(),
1896 D(ref mut f) => f.poll(),
1897 E(ref mut f) => f.poll(),
1898 F(ref mut f) => f.poll(),
1899 G(ref mut f) => f.poll(),
1900 H(ref mut f) => f.poll(),
1901 }
1902 }
1903}
1904
1905impl<A, B, C, D, E, F, G, H> HttpFuture for Either8<A, B, C, D, E, F, G, H>
1906where
1907 A: HttpFuture,
1908 B: HttpFuture,
1909 C: HttpFuture,
1910 D: HttpFuture,
1911 E: HttpFuture,
1912 F: HttpFuture,
1913 G: HttpFuture,
1914 H: HttpFuture,
1915{
1916 type Body = Either8<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body>;
1917
1918 fn poll_http(&mut self) -> Poll<http::Response<Self::Body>, ::Error> {
1919 use self::Either8::*;
1920
1921 match *self {
1922 A(ref mut f) => Ok(try_ready!(f.poll_http()).map(A).into()),
1923 B(ref mut f) => Ok(try_ready!(f.poll_http()).map(B).into()),
1924 C(ref mut f) => Ok(try_ready!(f.poll_http()).map(C).into()),
1925 D(ref mut f) => Ok(try_ready!(f.poll_http()).map(D).into()),
1926 E(ref mut f) => Ok(try_ready!(f.poll_http()).map(E).into()),
1927 F(ref mut f) => Ok(try_ready!(f.poll_http()).map(F).into()),
1928 G(ref mut f) => Ok(try_ready!(f.poll_http()).map(G).into()),
1929 H(ref mut f) => Ok(try_ready!(f.poll_http()).map(H).into()),
1930 }
1931 }
1932}
1933
1934impl<A, B, C, D, E, F, G, H> SealedFuture for Either8<A, B, C, D, E, F, G, H>
1935where
1936 A: HttpFuture,
1937 B: HttpFuture,
1938 C: HttpFuture,
1939 D: HttpFuture,
1940 E: HttpFuture,
1941 F: HttpFuture,
1942 G: HttpFuture,
1943 H: HttpFuture,
1944{
1945}
1946
1947impl<A, B, C, D, E, F, G, H> Stream for Either8<A, B, C, D, E, F, G, H>
1948where
1949 A: Stream,
1950 B: Stream<Error = A::Error>,
1951 C: Stream<Error = A::Error>,
1952 D: Stream<Error = A::Error>,
1953 E: Stream<Error = A::Error>,
1954 F: Stream<Error = A::Error>,
1955 G: Stream<Error = A::Error>,
1956 H: Stream<Error = A::Error>,
1957{
1958 type Item = Either8<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item>;
1959 type Error = A::Error;
1960
1961 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
1962 use self::Either8::*;
1963
1964 match *self {
1965 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
1966 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
1967 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
1968 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
1969 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
1970 F(ref mut f) => Ok(try_ready!(f.poll()).map(F).into()),
1971 G(ref mut f) => Ok(try_ready!(f.poll()).map(G).into()),
1972 H(ref mut f) => Ok(try_ready!(f.poll()).map(H).into()),
1973 }
1974 }
1975}
1976
1977impl<A, B, C, D, E, F, G, H> BufStream for Either8<A, B, C, D, E, F, G, H>
1978where
1979 A: BufStream,
1980 B: BufStream<Error = A::Error>,
1981 C: BufStream<Error = A::Error>,
1982 D: BufStream<Error = A::Error>,
1983 E: BufStream<Error = A::Error>,
1984 F: BufStream<Error = A::Error>,
1985 G: BufStream<Error = A::Error>,
1986 H: BufStream<Error = A::Error>,
1987{
1988 type Item = Either8<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item>;
1989 type Error = A::Error;
1990
1991 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
1992 use self::Either8::*;
1993
1994 match *self {
1995 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
1996 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
1997 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
1998 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
1999 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
2000 F(ref mut f) => Ok(try_ready!(f.poll()).map(F).into()),
2001 G(ref mut f) => Ok(try_ready!(f.poll()).map(G).into()),
2002 H(ref mut f) => Ok(try_ready!(f.poll()).map(H).into()),
2003 }
2004 }
2005}
2006
2007impl<A, B, C, D, E, F, G, H> Buf for Either8<A, B, C, D, E, F, G, H>
2008where
2009 A: Buf,
2010 B: Buf,
2011 C: Buf,
2012 D: Buf,
2013 E: Buf,
2014 F: Buf,
2015 G: Buf,
2016 H: Buf,
2017{
2018 fn remaining(&self) -> usize {
2019 use self::Either8::*;
2020
2021 match *self {
2022 A(ref b) => b.remaining(),
2023 B(ref b) => b.remaining(),
2024 C(ref b) => b.remaining(),
2025 D(ref b) => b.remaining(),
2026 E(ref b) => b.remaining(),
2027 F(ref b) => b.remaining(),
2028 G(ref b) => b.remaining(),
2029 H(ref b) => b.remaining(),
2030 }
2031 }
2032
2033 fn bytes(&self) -> &[u8] {
2034 use self::Either8::*;
2035
2036 match *self {
2037 A(ref b) => b.bytes(),
2038 B(ref b) => b.bytes(),
2039 C(ref b) => b.bytes(),
2040 D(ref b) => b.bytes(),
2041 E(ref b) => b.bytes(),
2042 F(ref b) => b.bytes(),
2043 G(ref b) => b.bytes(),
2044 H(ref b) => b.bytes(),
2045 }
2046 }
2047
2048 fn advance(&mut self, cnt: usize) {
2049 use self::Either8::*;
2050
2051 match *self {
2052 A(ref mut b) => b.advance(cnt),
2053 B(ref mut b) => b.advance(cnt),
2054 C(ref mut b) => b.advance(cnt),
2055 D(ref mut b) => b.advance(cnt),
2056 E(ref mut b) => b.advance(cnt),
2057 F(ref mut b) => b.advance(cnt),
2058 G(ref mut b) => b.advance(cnt),
2059 H(ref mut b) => b.advance(cnt),
2060 }
2061 }
2062}
2063
2064impl<A, B, C, D, E, F, G, H> Response for Either8<A, B, C, D, E, F, G, H>
2065where
2066 A: Response,
2067 B: Response,
2068 C: Response,
2069 D: Response,
2070 E: Response,
2071 F: Response,
2072 G: Response,
2073 H: Response,
2074{
2075 type Buf = Either8<A::Buf, B::Buf, C::Buf, D::Buf, E::Buf, F::Buf, G::Buf, H::Buf>;
2076 type Body = Either8<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body>;
2077
2078 fn into_http<S>(self, context: &Context<S>) -> Result<http::Response<Self::Body>, ::Error>
2079 where S: Serializer
2080 {
2081 use self::Either8::*;
2082
2083 match self {
2084 A(r) => Ok(r.into_http(context)?.map(Either8::A)),
2085 B(r) => Ok(r.into_http(context)?.map(Either8::B)),
2086 C(r) => Ok(r.into_http(context)?.map(Either8::C)),
2087 D(r) => Ok(r.into_http(context)?.map(Either8::D)),
2088 E(r) => Ok(r.into_http(context)?.map(Either8::E)),
2089 F(r) => Ok(r.into_http(context)?.map(Either8::F)),
2090 G(r) => Ok(r.into_http(context)?.map(Either8::G)),
2091 H(r) => Ok(r.into_http(context)?.map(Either8::H)),
2092 }
2093 }
2094}
2095
2096impl<R0, R1, R2, R3, R4, R5, R6, R7> Resource for (R0, R1, R2, R3, R4, R5, R6, R7,)
2097where
2098 R0: Resource,
2099 R1: Resource<RequestBody = R0::RequestBody>,
2100 R2: Resource<RequestBody = R0::RequestBody>,
2101 R3: Resource<RequestBody = R0::RequestBody>,
2102 R4: Resource<RequestBody = R0::RequestBody>,
2103 R5: Resource<RequestBody = R0::RequestBody>,
2104 R6: Resource<RequestBody = R0::RequestBody>,
2105 R7: Resource<RequestBody = R0::RequestBody>,
2106{
2107 type Destination = Either8<R0::Destination, R1::Destination, R2::Destination, R3::Destination, R4::Destination, R5::Destination, R6::Destination, R7::Destination>;
2108 type RequestBody = R0::RequestBody;
2109 type Buf = Either8<R0::Buf, R1::Buf, R2::Buf, R3::Buf, R4::Buf, R5::Buf, R6::Buf, R7::Buf>;
2110 type Body = Either8<R0::Body, R1::Body, R2::Body, R3::Body, R4::Body, R5::Body, R6::Body, R7::Body>;
2111 type Future = Either8<R0::Future, R1::Future, R2::Future, R3::Future, R4::Future, R5::Future, R6::Future, R7::Future>;
2112
2113 fn dispatch(&mut self,
2114 destination: Self::Destination,
2115 route_match: &RouteMatch,
2116 body: Self::RequestBody)
2117 -> Self::Future
2118 {
2119 use self::Either8::*;
2120
2121 match destination {
2122 A(d) => {
2123 A(self.0.dispatch(d, route_match, body))
2124 }
2125 B(d) => {
2126 B(self.1.dispatch(d, route_match, body))
2127 }
2128 C(d) => {
2129 C(self.2.dispatch(d, route_match, body))
2130 }
2131 D(d) => {
2132 D(self.3.dispatch(d, route_match, body))
2133 }
2134 E(d) => {
2135 E(self.4.dispatch(d, route_match, body))
2136 }
2137 F(d) => {
2138 F(self.5.dispatch(d, route_match, body))
2139 }
2140 G(d) => {
2141 G(self.6.dispatch(d, route_match, body))
2142 }
2143 H(d) => {
2144 H(self.7.dispatch(d, route_match, body))
2145 }
2146 }
2147 }
2148}
2149#[derive(Debug, Clone)]
2152pub enum Either9<A, B, C, D, E, F, G, H, I> {
2153 A(A),
2154 B(B),
2155 C(C),
2156 D(D),
2157 E(E),
2158 F(F),
2159 G(G),
2160 H(H),
2161 I(I),
2162}
2163
2164impl<A, B, C, D, E, F, G, H, I> Future for Either9<A, B, C, D, E, F, G, H, I>
2165where
2166 A: Future,
2167 B: Future<Error = A::Error>,
2168 C: Future<Error = A::Error>,
2169 D: Future<Error = A::Error>,
2170 E: Future<Error = A::Error>,
2171 F: Future<Error = A::Error>,
2172 G: Future<Error = A::Error>,
2173 H: Future<Error = A::Error>,
2174 I: Future<Error = A::Error>,
2175{
2176 type Item = Either9<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item, I::Item>;
2177 type Error = A::Error;
2178
2179 fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
2180 use self::Either9::*;
2181
2182 match *self {
2183 A(ref mut f) => Ok(A(try_ready!(f.poll())).into()),
2184 B(ref mut f) => Ok(B(try_ready!(f.poll())).into()),
2185 C(ref mut f) => Ok(C(try_ready!(f.poll())).into()),
2186 D(ref mut f) => Ok(D(try_ready!(f.poll())).into()),
2187 E(ref mut f) => Ok(E(try_ready!(f.poll())).into()),
2188 F(ref mut f) => Ok(F(try_ready!(f.poll())).into()),
2189 G(ref mut f) => Ok(G(try_ready!(f.poll())).into()),
2190 H(ref mut f) => Ok(H(try_ready!(f.poll())).into()),
2191 I(ref mut f) => Ok(I(try_ready!(f.poll())).into()),
2192 }
2193 }
2194}
2195
2196impl<A, B, C, D, E, F, G, H, I> ResourceFuture for Either9<A, B, C, D, E, F, G, H, I>
2197where
2198 A: ResourceFuture,
2199 B: ResourceFuture,
2200 C: ResourceFuture,
2201 D: ResourceFuture,
2202 E: ResourceFuture,
2203 F: ResourceFuture,
2204 G: ResourceFuture,
2205 H: ResourceFuture,
2206 I: ResourceFuture,
2207{
2208 type Body = Either9<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body, I::Body>;
2209
2210 fn poll_response(&mut self, request: &http::Request<()>) -> Poll<http::Response<Self::Body>, ::Error> {
2211 use self::Either9::*;
2212
2213 let response = match *self {
2214 A(ref mut f) => try_ready!(f.poll_response(request)).map(A),
2215 B(ref mut f) => try_ready!(f.poll_response(request)).map(B),
2216 C(ref mut f) => try_ready!(f.poll_response(request)).map(C),
2217 D(ref mut f) => try_ready!(f.poll_response(request)).map(D),
2218 E(ref mut f) => try_ready!(f.poll_response(request)).map(E),
2219 F(ref mut f) => try_ready!(f.poll_response(request)).map(F),
2220 G(ref mut f) => try_ready!(f.poll_response(request)).map(G),
2221 H(ref mut f) => try_ready!(f.poll_response(request)).map(H),
2222 I(ref mut f) => try_ready!(f.poll_response(request)).map(I),
2223 };
2224 Ok(response.into())
2225 }
2226}
2227
2228impl<A, B, C, D, E, F, G, H, I> Either9<A, B, C, D, E, F, G, H, I>
2229where
2230 A: ExtractFuture,
2231 B: ExtractFuture,
2232 C: ExtractFuture,
2233 D: ExtractFuture,
2234 E: ExtractFuture,
2235 F: ExtractFuture,
2236 G: ExtractFuture,
2237 H: ExtractFuture,
2238 I: ExtractFuture,
2239{
2240
2241 pub fn poll_ready(&mut self) -> Poll<(), extract::Error> {
2242 use self::Either9::*;
2243
2244 match *self {
2245 A(ref mut f) => f.poll(),
2246 B(ref mut f) => f.poll(),
2247 C(ref mut f) => f.poll(),
2248 D(ref mut f) => f.poll(),
2249 E(ref mut f) => f.poll(),
2250 F(ref mut f) => f.poll(),
2251 G(ref mut f) => f.poll(),
2252 H(ref mut f) => f.poll(),
2253 I(ref mut f) => f.poll(),
2254 }
2255 }
2256}
2257
2258impl<A, B, C, D, E, F, G, H, I> HttpFuture for Either9<A, B, C, D, E, F, G, H, I>
2259where
2260 A: HttpFuture,
2261 B: HttpFuture,
2262 C: HttpFuture,
2263 D: HttpFuture,
2264 E: HttpFuture,
2265 F: HttpFuture,
2266 G: HttpFuture,
2267 H: HttpFuture,
2268 I: HttpFuture,
2269{
2270 type Body = Either9<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body, I::Body>;
2271
2272 fn poll_http(&mut self) -> Poll<http::Response<Self::Body>, ::Error> {
2273 use self::Either9::*;
2274
2275 match *self {
2276 A(ref mut f) => Ok(try_ready!(f.poll_http()).map(A).into()),
2277 B(ref mut f) => Ok(try_ready!(f.poll_http()).map(B).into()),
2278 C(ref mut f) => Ok(try_ready!(f.poll_http()).map(C).into()),
2279 D(ref mut f) => Ok(try_ready!(f.poll_http()).map(D).into()),
2280 E(ref mut f) => Ok(try_ready!(f.poll_http()).map(E).into()),
2281 F(ref mut f) => Ok(try_ready!(f.poll_http()).map(F).into()),
2282 G(ref mut f) => Ok(try_ready!(f.poll_http()).map(G).into()),
2283 H(ref mut f) => Ok(try_ready!(f.poll_http()).map(H).into()),
2284 I(ref mut f) => Ok(try_ready!(f.poll_http()).map(I).into()),
2285 }
2286 }
2287}
2288
2289impl<A, B, C, D, E, F, G, H, I> SealedFuture for Either9<A, B, C, D, E, F, G, H, I>
2290where
2291 A: HttpFuture,
2292 B: HttpFuture,
2293 C: HttpFuture,
2294 D: HttpFuture,
2295 E: HttpFuture,
2296 F: HttpFuture,
2297 G: HttpFuture,
2298 H: HttpFuture,
2299 I: HttpFuture,
2300{
2301}
2302
2303impl<A, B, C, D, E, F, G, H, I> Stream for Either9<A, B, C, D, E, F, G, H, I>
2304where
2305 A: Stream,
2306 B: Stream<Error = A::Error>,
2307 C: Stream<Error = A::Error>,
2308 D: Stream<Error = A::Error>,
2309 E: Stream<Error = A::Error>,
2310 F: Stream<Error = A::Error>,
2311 G: Stream<Error = A::Error>,
2312 H: Stream<Error = A::Error>,
2313 I: Stream<Error = A::Error>,
2314{
2315 type Item = Either9<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item, I::Item>;
2316 type Error = A::Error;
2317
2318 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
2319 use self::Either9::*;
2320
2321 match *self {
2322 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
2323 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
2324 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
2325 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
2326 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
2327 F(ref mut f) => Ok(try_ready!(f.poll()).map(F).into()),
2328 G(ref mut f) => Ok(try_ready!(f.poll()).map(G).into()),
2329 H(ref mut f) => Ok(try_ready!(f.poll()).map(H).into()),
2330 I(ref mut f) => Ok(try_ready!(f.poll()).map(I).into()),
2331 }
2332 }
2333}
2334
2335impl<A, B, C, D, E, F, G, H, I> BufStream for Either9<A, B, C, D, E, F, G, H, I>
2336where
2337 A: BufStream,
2338 B: BufStream<Error = A::Error>,
2339 C: BufStream<Error = A::Error>,
2340 D: BufStream<Error = A::Error>,
2341 E: BufStream<Error = A::Error>,
2342 F: BufStream<Error = A::Error>,
2343 G: BufStream<Error = A::Error>,
2344 H: BufStream<Error = A::Error>,
2345 I: BufStream<Error = A::Error>,
2346{
2347 type Item = Either9<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item, I::Item>;
2348 type Error = A::Error;
2349
2350 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
2351 use self::Either9::*;
2352
2353 match *self {
2354 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
2355 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
2356 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
2357 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
2358 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
2359 F(ref mut f) => Ok(try_ready!(f.poll()).map(F).into()),
2360 G(ref mut f) => Ok(try_ready!(f.poll()).map(G).into()),
2361 H(ref mut f) => Ok(try_ready!(f.poll()).map(H).into()),
2362 I(ref mut f) => Ok(try_ready!(f.poll()).map(I).into()),
2363 }
2364 }
2365}
2366
2367impl<A, B, C, D, E, F, G, H, I> Buf for Either9<A, B, C, D, E, F, G, H, I>
2368where
2369 A: Buf,
2370 B: Buf,
2371 C: Buf,
2372 D: Buf,
2373 E: Buf,
2374 F: Buf,
2375 G: Buf,
2376 H: Buf,
2377 I: Buf,
2378{
2379 fn remaining(&self) -> usize {
2380 use self::Either9::*;
2381
2382 match *self {
2383 A(ref b) => b.remaining(),
2384 B(ref b) => b.remaining(),
2385 C(ref b) => b.remaining(),
2386 D(ref b) => b.remaining(),
2387 E(ref b) => b.remaining(),
2388 F(ref b) => b.remaining(),
2389 G(ref b) => b.remaining(),
2390 H(ref b) => b.remaining(),
2391 I(ref b) => b.remaining(),
2392 }
2393 }
2394
2395 fn bytes(&self) -> &[u8] {
2396 use self::Either9::*;
2397
2398 match *self {
2399 A(ref b) => b.bytes(),
2400 B(ref b) => b.bytes(),
2401 C(ref b) => b.bytes(),
2402 D(ref b) => b.bytes(),
2403 E(ref b) => b.bytes(),
2404 F(ref b) => b.bytes(),
2405 G(ref b) => b.bytes(),
2406 H(ref b) => b.bytes(),
2407 I(ref b) => b.bytes(),
2408 }
2409 }
2410
2411 fn advance(&mut self, cnt: usize) {
2412 use self::Either9::*;
2413
2414 match *self {
2415 A(ref mut b) => b.advance(cnt),
2416 B(ref mut b) => b.advance(cnt),
2417 C(ref mut b) => b.advance(cnt),
2418 D(ref mut b) => b.advance(cnt),
2419 E(ref mut b) => b.advance(cnt),
2420 F(ref mut b) => b.advance(cnt),
2421 G(ref mut b) => b.advance(cnt),
2422 H(ref mut b) => b.advance(cnt),
2423 I(ref mut b) => b.advance(cnt),
2424 }
2425 }
2426}
2427
2428impl<A, B, C, D, E, F, G, H, I> Response for Either9<A, B, C, D, E, F, G, H, I>
2429where
2430 A: Response,
2431 B: Response,
2432 C: Response,
2433 D: Response,
2434 E: Response,
2435 F: Response,
2436 G: Response,
2437 H: Response,
2438 I: Response,
2439{
2440 type Buf = Either9<A::Buf, B::Buf, C::Buf, D::Buf, E::Buf, F::Buf, G::Buf, H::Buf, I::Buf>;
2441 type Body = Either9<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body, I::Body>;
2442
2443 fn into_http<S>(self, context: &Context<S>) -> Result<http::Response<Self::Body>, ::Error>
2444 where S: Serializer
2445 {
2446 use self::Either9::*;
2447
2448 match self {
2449 A(r) => Ok(r.into_http(context)?.map(Either9::A)),
2450 B(r) => Ok(r.into_http(context)?.map(Either9::B)),
2451 C(r) => Ok(r.into_http(context)?.map(Either9::C)),
2452 D(r) => Ok(r.into_http(context)?.map(Either9::D)),
2453 E(r) => Ok(r.into_http(context)?.map(Either9::E)),
2454 F(r) => Ok(r.into_http(context)?.map(Either9::F)),
2455 G(r) => Ok(r.into_http(context)?.map(Either9::G)),
2456 H(r) => Ok(r.into_http(context)?.map(Either9::H)),
2457 I(r) => Ok(r.into_http(context)?.map(Either9::I)),
2458 }
2459 }
2460}
2461
2462impl<R0, R1, R2, R3, R4, R5, R6, R7, R8> Resource for (R0, R1, R2, R3, R4, R5, R6, R7, R8,)
2463where
2464 R0: Resource,
2465 R1: Resource<RequestBody = R0::RequestBody>,
2466 R2: Resource<RequestBody = R0::RequestBody>,
2467 R3: Resource<RequestBody = R0::RequestBody>,
2468 R4: Resource<RequestBody = R0::RequestBody>,
2469 R5: Resource<RequestBody = R0::RequestBody>,
2470 R6: Resource<RequestBody = R0::RequestBody>,
2471 R7: Resource<RequestBody = R0::RequestBody>,
2472 R8: Resource<RequestBody = R0::RequestBody>,
2473{
2474 type Destination = Either9<R0::Destination, R1::Destination, R2::Destination, R3::Destination, R4::Destination, R5::Destination, R6::Destination, R7::Destination, R8::Destination>;
2475 type RequestBody = R0::RequestBody;
2476 type Buf = Either9<R0::Buf, R1::Buf, R2::Buf, R3::Buf, R4::Buf, R5::Buf, R6::Buf, R7::Buf, R8::Buf>;
2477 type Body = Either9<R0::Body, R1::Body, R2::Body, R3::Body, R4::Body, R5::Body, R6::Body, R7::Body, R8::Body>;
2478 type Future = Either9<R0::Future, R1::Future, R2::Future, R3::Future, R4::Future, R5::Future, R6::Future, R7::Future, R8::Future>;
2479
2480 fn dispatch(&mut self,
2481 destination: Self::Destination,
2482 route_match: &RouteMatch,
2483 body: Self::RequestBody)
2484 -> Self::Future
2485 {
2486 use self::Either9::*;
2487
2488 match destination {
2489 A(d) => {
2490 A(self.0.dispatch(d, route_match, body))
2491 }
2492 B(d) => {
2493 B(self.1.dispatch(d, route_match, body))
2494 }
2495 C(d) => {
2496 C(self.2.dispatch(d, route_match, body))
2497 }
2498 D(d) => {
2499 D(self.3.dispatch(d, route_match, body))
2500 }
2501 E(d) => {
2502 E(self.4.dispatch(d, route_match, body))
2503 }
2504 F(d) => {
2505 F(self.5.dispatch(d, route_match, body))
2506 }
2507 G(d) => {
2508 G(self.6.dispatch(d, route_match, body))
2509 }
2510 H(d) => {
2511 H(self.7.dispatch(d, route_match, body))
2512 }
2513 I(d) => {
2514 I(self.8.dispatch(d, route_match, body))
2515 }
2516 }
2517 }
2518}
2519#[derive(Debug, Clone)]
2522pub enum Either10<A, B, C, D, E, F, G, H, I, J> {
2523 A(A),
2524 B(B),
2525 C(C),
2526 D(D),
2527 E(E),
2528 F(F),
2529 G(G),
2530 H(H),
2531 I(I),
2532 J(J),
2533}
2534
2535impl<A, B, C, D, E, F, G, H, I, J> Future for Either10<A, B, C, D, E, F, G, H, I, J>
2536where
2537 A: Future,
2538 B: Future<Error = A::Error>,
2539 C: Future<Error = A::Error>,
2540 D: Future<Error = A::Error>,
2541 E: Future<Error = A::Error>,
2542 F: Future<Error = A::Error>,
2543 G: Future<Error = A::Error>,
2544 H: Future<Error = A::Error>,
2545 I: Future<Error = A::Error>,
2546 J: Future<Error = A::Error>,
2547{
2548 type Item = Either10<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item, I::Item, J::Item>;
2549 type Error = A::Error;
2550
2551 fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
2552 use self::Either10::*;
2553
2554 match *self {
2555 A(ref mut f) => Ok(A(try_ready!(f.poll())).into()),
2556 B(ref mut f) => Ok(B(try_ready!(f.poll())).into()),
2557 C(ref mut f) => Ok(C(try_ready!(f.poll())).into()),
2558 D(ref mut f) => Ok(D(try_ready!(f.poll())).into()),
2559 E(ref mut f) => Ok(E(try_ready!(f.poll())).into()),
2560 F(ref mut f) => Ok(F(try_ready!(f.poll())).into()),
2561 G(ref mut f) => Ok(G(try_ready!(f.poll())).into()),
2562 H(ref mut f) => Ok(H(try_ready!(f.poll())).into()),
2563 I(ref mut f) => Ok(I(try_ready!(f.poll())).into()),
2564 J(ref mut f) => Ok(J(try_ready!(f.poll())).into()),
2565 }
2566 }
2567}
2568
2569impl<A, B, C, D, E, F, G, H, I, J> ResourceFuture for Either10<A, B, C, D, E, F, G, H, I, J>
2570where
2571 A: ResourceFuture,
2572 B: ResourceFuture,
2573 C: ResourceFuture,
2574 D: ResourceFuture,
2575 E: ResourceFuture,
2576 F: ResourceFuture,
2577 G: ResourceFuture,
2578 H: ResourceFuture,
2579 I: ResourceFuture,
2580 J: ResourceFuture,
2581{
2582 type Body = Either10<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body, I::Body, J::Body>;
2583
2584 fn poll_response(&mut self, request: &http::Request<()>) -> Poll<http::Response<Self::Body>, ::Error> {
2585 use self::Either10::*;
2586
2587 let response = match *self {
2588 A(ref mut f) => try_ready!(f.poll_response(request)).map(A),
2589 B(ref mut f) => try_ready!(f.poll_response(request)).map(B),
2590 C(ref mut f) => try_ready!(f.poll_response(request)).map(C),
2591 D(ref mut f) => try_ready!(f.poll_response(request)).map(D),
2592 E(ref mut f) => try_ready!(f.poll_response(request)).map(E),
2593 F(ref mut f) => try_ready!(f.poll_response(request)).map(F),
2594 G(ref mut f) => try_ready!(f.poll_response(request)).map(G),
2595 H(ref mut f) => try_ready!(f.poll_response(request)).map(H),
2596 I(ref mut f) => try_ready!(f.poll_response(request)).map(I),
2597 J(ref mut f) => try_ready!(f.poll_response(request)).map(J),
2598 };
2599 Ok(response.into())
2600 }
2601}
2602
2603impl<A, B, C, D, E, F, G, H, I, J> Either10<A, B, C, D, E, F, G, H, I, J>
2604where
2605 A: ExtractFuture,
2606 B: ExtractFuture,
2607 C: ExtractFuture,
2608 D: ExtractFuture,
2609 E: ExtractFuture,
2610 F: ExtractFuture,
2611 G: ExtractFuture,
2612 H: ExtractFuture,
2613 I: ExtractFuture,
2614 J: ExtractFuture,
2615{
2616
2617 pub fn poll_ready(&mut self) -> Poll<(), extract::Error> {
2618 use self::Either10::*;
2619
2620 match *self {
2621 A(ref mut f) => f.poll(),
2622 B(ref mut f) => f.poll(),
2623 C(ref mut f) => f.poll(),
2624 D(ref mut f) => f.poll(),
2625 E(ref mut f) => f.poll(),
2626 F(ref mut f) => f.poll(),
2627 G(ref mut f) => f.poll(),
2628 H(ref mut f) => f.poll(),
2629 I(ref mut f) => f.poll(),
2630 J(ref mut f) => f.poll(),
2631 }
2632 }
2633}
2634
2635impl<A, B, C, D, E, F, G, H, I, J> HttpFuture for Either10<A, B, C, D, E, F, G, H, I, J>
2636where
2637 A: HttpFuture,
2638 B: HttpFuture,
2639 C: HttpFuture,
2640 D: HttpFuture,
2641 E: HttpFuture,
2642 F: HttpFuture,
2643 G: HttpFuture,
2644 H: HttpFuture,
2645 I: HttpFuture,
2646 J: HttpFuture,
2647{
2648 type Body = Either10<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body, I::Body, J::Body>;
2649
2650 fn poll_http(&mut self) -> Poll<http::Response<Self::Body>, ::Error> {
2651 use self::Either10::*;
2652
2653 match *self {
2654 A(ref mut f) => Ok(try_ready!(f.poll_http()).map(A).into()),
2655 B(ref mut f) => Ok(try_ready!(f.poll_http()).map(B).into()),
2656 C(ref mut f) => Ok(try_ready!(f.poll_http()).map(C).into()),
2657 D(ref mut f) => Ok(try_ready!(f.poll_http()).map(D).into()),
2658 E(ref mut f) => Ok(try_ready!(f.poll_http()).map(E).into()),
2659 F(ref mut f) => Ok(try_ready!(f.poll_http()).map(F).into()),
2660 G(ref mut f) => Ok(try_ready!(f.poll_http()).map(G).into()),
2661 H(ref mut f) => Ok(try_ready!(f.poll_http()).map(H).into()),
2662 I(ref mut f) => Ok(try_ready!(f.poll_http()).map(I).into()),
2663 J(ref mut f) => Ok(try_ready!(f.poll_http()).map(J).into()),
2664 }
2665 }
2666}
2667
2668impl<A, B, C, D, E, F, G, H, I, J> SealedFuture for Either10<A, B, C, D, E, F, G, H, I, J>
2669where
2670 A: HttpFuture,
2671 B: HttpFuture,
2672 C: HttpFuture,
2673 D: HttpFuture,
2674 E: HttpFuture,
2675 F: HttpFuture,
2676 G: HttpFuture,
2677 H: HttpFuture,
2678 I: HttpFuture,
2679 J: HttpFuture,
2680{
2681}
2682
2683impl<A, B, C, D, E, F, G, H, I, J> Stream for Either10<A, B, C, D, E, F, G, H, I, J>
2684where
2685 A: Stream,
2686 B: Stream<Error = A::Error>,
2687 C: Stream<Error = A::Error>,
2688 D: Stream<Error = A::Error>,
2689 E: Stream<Error = A::Error>,
2690 F: Stream<Error = A::Error>,
2691 G: Stream<Error = A::Error>,
2692 H: Stream<Error = A::Error>,
2693 I: Stream<Error = A::Error>,
2694 J: Stream<Error = A::Error>,
2695{
2696 type Item = Either10<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item, I::Item, J::Item>;
2697 type Error = A::Error;
2698
2699 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
2700 use self::Either10::*;
2701
2702 match *self {
2703 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
2704 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
2705 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
2706 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
2707 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
2708 F(ref mut f) => Ok(try_ready!(f.poll()).map(F).into()),
2709 G(ref mut f) => Ok(try_ready!(f.poll()).map(G).into()),
2710 H(ref mut f) => Ok(try_ready!(f.poll()).map(H).into()),
2711 I(ref mut f) => Ok(try_ready!(f.poll()).map(I).into()),
2712 J(ref mut f) => Ok(try_ready!(f.poll()).map(J).into()),
2713 }
2714 }
2715}
2716
2717impl<A, B, C, D, E, F, G, H, I, J> BufStream for Either10<A, B, C, D, E, F, G, H, I, J>
2718where
2719 A: BufStream,
2720 B: BufStream<Error = A::Error>,
2721 C: BufStream<Error = A::Error>,
2722 D: BufStream<Error = A::Error>,
2723 E: BufStream<Error = A::Error>,
2724 F: BufStream<Error = A::Error>,
2725 G: BufStream<Error = A::Error>,
2726 H: BufStream<Error = A::Error>,
2727 I: BufStream<Error = A::Error>,
2728 J: BufStream<Error = A::Error>,
2729{
2730 type Item = Either10<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item, I::Item, J::Item>;
2731 type Error = A::Error;
2732
2733 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
2734 use self::Either10::*;
2735
2736 match *self {
2737 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
2738 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
2739 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
2740 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
2741 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
2742 F(ref mut f) => Ok(try_ready!(f.poll()).map(F).into()),
2743 G(ref mut f) => Ok(try_ready!(f.poll()).map(G).into()),
2744 H(ref mut f) => Ok(try_ready!(f.poll()).map(H).into()),
2745 I(ref mut f) => Ok(try_ready!(f.poll()).map(I).into()),
2746 J(ref mut f) => Ok(try_ready!(f.poll()).map(J).into()),
2747 }
2748 }
2749}
2750
2751impl<A, B, C, D, E, F, G, H, I, J> Buf for Either10<A, B, C, D, E, F, G, H, I, J>
2752where
2753 A: Buf,
2754 B: Buf,
2755 C: Buf,
2756 D: Buf,
2757 E: Buf,
2758 F: Buf,
2759 G: Buf,
2760 H: Buf,
2761 I: Buf,
2762 J: Buf,
2763{
2764 fn remaining(&self) -> usize {
2765 use self::Either10::*;
2766
2767 match *self {
2768 A(ref b) => b.remaining(),
2769 B(ref b) => b.remaining(),
2770 C(ref b) => b.remaining(),
2771 D(ref b) => b.remaining(),
2772 E(ref b) => b.remaining(),
2773 F(ref b) => b.remaining(),
2774 G(ref b) => b.remaining(),
2775 H(ref b) => b.remaining(),
2776 I(ref b) => b.remaining(),
2777 J(ref b) => b.remaining(),
2778 }
2779 }
2780
2781 fn bytes(&self) -> &[u8] {
2782 use self::Either10::*;
2783
2784 match *self {
2785 A(ref b) => b.bytes(),
2786 B(ref b) => b.bytes(),
2787 C(ref b) => b.bytes(),
2788 D(ref b) => b.bytes(),
2789 E(ref b) => b.bytes(),
2790 F(ref b) => b.bytes(),
2791 G(ref b) => b.bytes(),
2792 H(ref b) => b.bytes(),
2793 I(ref b) => b.bytes(),
2794 J(ref b) => b.bytes(),
2795 }
2796 }
2797
2798 fn advance(&mut self, cnt: usize) {
2799 use self::Either10::*;
2800
2801 match *self {
2802 A(ref mut b) => b.advance(cnt),
2803 B(ref mut b) => b.advance(cnt),
2804 C(ref mut b) => b.advance(cnt),
2805 D(ref mut b) => b.advance(cnt),
2806 E(ref mut b) => b.advance(cnt),
2807 F(ref mut b) => b.advance(cnt),
2808 G(ref mut b) => b.advance(cnt),
2809 H(ref mut b) => b.advance(cnt),
2810 I(ref mut b) => b.advance(cnt),
2811 J(ref mut b) => b.advance(cnt),
2812 }
2813 }
2814}
2815
2816impl<A, B, C, D, E, F, G, H, I, J> Response for Either10<A, B, C, D, E, F, G, H, I, J>
2817where
2818 A: Response,
2819 B: Response,
2820 C: Response,
2821 D: Response,
2822 E: Response,
2823 F: Response,
2824 G: Response,
2825 H: Response,
2826 I: Response,
2827 J: Response,
2828{
2829 type Buf = Either10<A::Buf, B::Buf, C::Buf, D::Buf, E::Buf, F::Buf, G::Buf, H::Buf, I::Buf, J::Buf>;
2830 type Body = Either10<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body, I::Body, J::Body>;
2831
2832 fn into_http<S>(self, context: &Context<S>) -> Result<http::Response<Self::Body>, ::Error>
2833 where S: Serializer
2834 {
2835 use self::Either10::*;
2836
2837 match self {
2838 A(r) => Ok(r.into_http(context)?.map(Either10::A)),
2839 B(r) => Ok(r.into_http(context)?.map(Either10::B)),
2840 C(r) => Ok(r.into_http(context)?.map(Either10::C)),
2841 D(r) => Ok(r.into_http(context)?.map(Either10::D)),
2842 E(r) => Ok(r.into_http(context)?.map(Either10::E)),
2843 F(r) => Ok(r.into_http(context)?.map(Either10::F)),
2844 G(r) => Ok(r.into_http(context)?.map(Either10::G)),
2845 H(r) => Ok(r.into_http(context)?.map(Either10::H)),
2846 I(r) => Ok(r.into_http(context)?.map(Either10::I)),
2847 J(r) => Ok(r.into_http(context)?.map(Either10::J)),
2848 }
2849 }
2850}
2851
2852impl<R0, R1, R2, R3, R4, R5, R6, R7, R8, R9> Resource for (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9,)
2853where
2854 R0: Resource,
2855 R1: Resource<RequestBody = R0::RequestBody>,
2856 R2: Resource<RequestBody = R0::RequestBody>,
2857 R3: Resource<RequestBody = R0::RequestBody>,
2858 R4: Resource<RequestBody = R0::RequestBody>,
2859 R5: Resource<RequestBody = R0::RequestBody>,
2860 R6: Resource<RequestBody = R0::RequestBody>,
2861 R7: Resource<RequestBody = R0::RequestBody>,
2862 R8: Resource<RequestBody = R0::RequestBody>,
2863 R9: Resource<RequestBody = R0::RequestBody>,
2864{
2865 type Destination = Either10<R0::Destination, R1::Destination, R2::Destination, R3::Destination, R4::Destination, R5::Destination, R6::Destination, R7::Destination, R8::Destination, R9::Destination>;
2866 type RequestBody = R0::RequestBody;
2867 type Buf = Either10<R0::Buf, R1::Buf, R2::Buf, R3::Buf, R4::Buf, R5::Buf, R6::Buf, R7::Buf, R8::Buf, R9::Buf>;
2868 type Body = Either10<R0::Body, R1::Body, R2::Body, R3::Body, R4::Body, R5::Body, R6::Body, R7::Body, R8::Body, R9::Body>;
2869 type Future = Either10<R0::Future, R1::Future, R2::Future, R3::Future, R4::Future, R5::Future, R6::Future, R7::Future, R8::Future, R9::Future>;
2870
2871 fn dispatch(&mut self,
2872 destination: Self::Destination,
2873 route_match: &RouteMatch,
2874 body: Self::RequestBody)
2875 -> Self::Future
2876 {
2877 use self::Either10::*;
2878
2879 match destination {
2880 A(d) => {
2881 A(self.0.dispatch(d, route_match, body))
2882 }
2883 B(d) => {
2884 B(self.1.dispatch(d, route_match, body))
2885 }
2886 C(d) => {
2887 C(self.2.dispatch(d, route_match, body))
2888 }
2889 D(d) => {
2890 D(self.3.dispatch(d, route_match, body))
2891 }
2892 E(d) => {
2893 E(self.4.dispatch(d, route_match, body))
2894 }
2895 F(d) => {
2896 F(self.5.dispatch(d, route_match, body))
2897 }
2898 G(d) => {
2899 G(self.6.dispatch(d, route_match, body))
2900 }
2901 H(d) => {
2902 H(self.7.dispatch(d, route_match, body))
2903 }
2904 I(d) => {
2905 I(self.8.dispatch(d, route_match, body))
2906 }
2907 J(d) => {
2908 J(self.9.dispatch(d, route_match, body))
2909 }
2910 }
2911 }
2912}
2913#[derive(Debug, Clone)]
2916pub enum Either11<A, B, C, D, E, F, G, H, I, J, K> {
2917 A(A),
2918 B(B),
2919 C(C),
2920 D(D),
2921 E(E),
2922 F(F),
2923 G(G),
2924 H(H),
2925 I(I),
2926 J(J),
2927 K(K),
2928}
2929
2930impl<A, B, C, D, E, F, G, H, I, J, K> Future for Either11<A, B, C, D, E, F, G, H, I, J, K>
2931where
2932 A: Future,
2933 B: Future<Error = A::Error>,
2934 C: Future<Error = A::Error>,
2935 D: Future<Error = A::Error>,
2936 E: Future<Error = A::Error>,
2937 F: Future<Error = A::Error>,
2938 G: Future<Error = A::Error>,
2939 H: Future<Error = A::Error>,
2940 I: Future<Error = A::Error>,
2941 J: Future<Error = A::Error>,
2942 K: Future<Error = A::Error>,
2943{
2944 type Item = Either11<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item, I::Item, J::Item, K::Item>;
2945 type Error = A::Error;
2946
2947 fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
2948 use self::Either11::*;
2949
2950 match *self {
2951 A(ref mut f) => Ok(A(try_ready!(f.poll())).into()),
2952 B(ref mut f) => Ok(B(try_ready!(f.poll())).into()),
2953 C(ref mut f) => Ok(C(try_ready!(f.poll())).into()),
2954 D(ref mut f) => Ok(D(try_ready!(f.poll())).into()),
2955 E(ref mut f) => Ok(E(try_ready!(f.poll())).into()),
2956 F(ref mut f) => Ok(F(try_ready!(f.poll())).into()),
2957 G(ref mut f) => Ok(G(try_ready!(f.poll())).into()),
2958 H(ref mut f) => Ok(H(try_ready!(f.poll())).into()),
2959 I(ref mut f) => Ok(I(try_ready!(f.poll())).into()),
2960 J(ref mut f) => Ok(J(try_ready!(f.poll())).into()),
2961 K(ref mut f) => Ok(K(try_ready!(f.poll())).into()),
2962 }
2963 }
2964}
2965
2966impl<A, B, C, D, E, F, G, H, I, J, K> ResourceFuture for Either11<A, B, C, D, E, F, G, H, I, J, K>
2967where
2968 A: ResourceFuture,
2969 B: ResourceFuture,
2970 C: ResourceFuture,
2971 D: ResourceFuture,
2972 E: ResourceFuture,
2973 F: ResourceFuture,
2974 G: ResourceFuture,
2975 H: ResourceFuture,
2976 I: ResourceFuture,
2977 J: ResourceFuture,
2978 K: ResourceFuture,
2979{
2980 type Body = Either11<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body, I::Body, J::Body, K::Body>;
2981
2982 fn poll_response(&mut self, request: &http::Request<()>) -> Poll<http::Response<Self::Body>, ::Error> {
2983 use self::Either11::*;
2984
2985 let response = match *self {
2986 A(ref mut f) => try_ready!(f.poll_response(request)).map(A),
2987 B(ref mut f) => try_ready!(f.poll_response(request)).map(B),
2988 C(ref mut f) => try_ready!(f.poll_response(request)).map(C),
2989 D(ref mut f) => try_ready!(f.poll_response(request)).map(D),
2990 E(ref mut f) => try_ready!(f.poll_response(request)).map(E),
2991 F(ref mut f) => try_ready!(f.poll_response(request)).map(F),
2992 G(ref mut f) => try_ready!(f.poll_response(request)).map(G),
2993 H(ref mut f) => try_ready!(f.poll_response(request)).map(H),
2994 I(ref mut f) => try_ready!(f.poll_response(request)).map(I),
2995 J(ref mut f) => try_ready!(f.poll_response(request)).map(J),
2996 K(ref mut f) => try_ready!(f.poll_response(request)).map(K),
2997 };
2998 Ok(response.into())
2999 }
3000}
3001
3002impl<A, B, C, D, E, F, G, H, I, J, K> Either11<A, B, C, D, E, F, G, H, I, J, K>
3003where
3004 A: ExtractFuture,
3005 B: ExtractFuture,
3006 C: ExtractFuture,
3007 D: ExtractFuture,
3008 E: ExtractFuture,
3009 F: ExtractFuture,
3010 G: ExtractFuture,
3011 H: ExtractFuture,
3012 I: ExtractFuture,
3013 J: ExtractFuture,
3014 K: ExtractFuture,
3015{
3016
3017 pub fn poll_ready(&mut self) -> Poll<(), extract::Error> {
3018 use self::Either11::*;
3019
3020 match *self {
3021 A(ref mut f) => f.poll(),
3022 B(ref mut f) => f.poll(),
3023 C(ref mut f) => f.poll(),
3024 D(ref mut f) => f.poll(),
3025 E(ref mut f) => f.poll(),
3026 F(ref mut f) => f.poll(),
3027 G(ref mut f) => f.poll(),
3028 H(ref mut f) => f.poll(),
3029 I(ref mut f) => f.poll(),
3030 J(ref mut f) => f.poll(),
3031 K(ref mut f) => f.poll(),
3032 }
3033 }
3034}
3035
3036impl<A, B, C, D, E, F, G, H, I, J, K> HttpFuture for Either11<A, B, C, D, E, F, G, H, I, J, K>
3037where
3038 A: HttpFuture,
3039 B: HttpFuture,
3040 C: HttpFuture,
3041 D: HttpFuture,
3042 E: HttpFuture,
3043 F: HttpFuture,
3044 G: HttpFuture,
3045 H: HttpFuture,
3046 I: HttpFuture,
3047 J: HttpFuture,
3048 K: HttpFuture,
3049{
3050 type Body = Either11<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body, I::Body, J::Body, K::Body>;
3051
3052 fn poll_http(&mut self) -> Poll<http::Response<Self::Body>, ::Error> {
3053 use self::Either11::*;
3054
3055 match *self {
3056 A(ref mut f) => Ok(try_ready!(f.poll_http()).map(A).into()),
3057 B(ref mut f) => Ok(try_ready!(f.poll_http()).map(B).into()),
3058 C(ref mut f) => Ok(try_ready!(f.poll_http()).map(C).into()),
3059 D(ref mut f) => Ok(try_ready!(f.poll_http()).map(D).into()),
3060 E(ref mut f) => Ok(try_ready!(f.poll_http()).map(E).into()),
3061 F(ref mut f) => Ok(try_ready!(f.poll_http()).map(F).into()),
3062 G(ref mut f) => Ok(try_ready!(f.poll_http()).map(G).into()),
3063 H(ref mut f) => Ok(try_ready!(f.poll_http()).map(H).into()),
3064 I(ref mut f) => Ok(try_ready!(f.poll_http()).map(I).into()),
3065 J(ref mut f) => Ok(try_ready!(f.poll_http()).map(J).into()),
3066 K(ref mut f) => Ok(try_ready!(f.poll_http()).map(K).into()),
3067 }
3068 }
3069}
3070
3071impl<A, B, C, D, E, F, G, H, I, J, K> SealedFuture for Either11<A, B, C, D, E, F, G, H, I, J, K>
3072where
3073 A: HttpFuture,
3074 B: HttpFuture,
3075 C: HttpFuture,
3076 D: HttpFuture,
3077 E: HttpFuture,
3078 F: HttpFuture,
3079 G: HttpFuture,
3080 H: HttpFuture,
3081 I: HttpFuture,
3082 J: HttpFuture,
3083 K: HttpFuture,
3084{
3085}
3086
3087impl<A, B, C, D, E, F, G, H, I, J, K> Stream for Either11<A, B, C, D, E, F, G, H, I, J, K>
3088where
3089 A: Stream,
3090 B: Stream<Error = A::Error>,
3091 C: Stream<Error = A::Error>,
3092 D: Stream<Error = A::Error>,
3093 E: Stream<Error = A::Error>,
3094 F: Stream<Error = A::Error>,
3095 G: Stream<Error = A::Error>,
3096 H: Stream<Error = A::Error>,
3097 I: Stream<Error = A::Error>,
3098 J: Stream<Error = A::Error>,
3099 K: Stream<Error = A::Error>,
3100{
3101 type Item = Either11<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item, I::Item, J::Item, K::Item>;
3102 type Error = A::Error;
3103
3104 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
3105 use self::Either11::*;
3106
3107 match *self {
3108 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
3109 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
3110 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
3111 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
3112 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
3113 F(ref mut f) => Ok(try_ready!(f.poll()).map(F).into()),
3114 G(ref mut f) => Ok(try_ready!(f.poll()).map(G).into()),
3115 H(ref mut f) => Ok(try_ready!(f.poll()).map(H).into()),
3116 I(ref mut f) => Ok(try_ready!(f.poll()).map(I).into()),
3117 J(ref mut f) => Ok(try_ready!(f.poll()).map(J).into()),
3118 K(ref mut f) => Ok(try_ready!(f.poll()).map(K).into()),
3119 }
3120 }
3121}
3122
3123impl<A, B, C, D, E, F, G, H, I, J, K> BufStream for Either11<A, B, C, D, E, F, G, H, I, J, K>
3124where
3125 A: BufStream,
3126 B: BufStream<Error = A::Error>,
3127 C: BufStream<Error = A::Error>,
3128 D: BufStream<Error = A::Error>,
3129 E: BufStream<Error = A::Error>,
3130 F: BufStream<Error = A::Error>,
3131 G: BufStream<Error = A::Error>,
3132 H: BufStream<Error = A::Error>,
3133 I: BufStream<Error = A::Error>,
3134 J: BufStream<Error = A::Error>,
3135 K: BufStream<Error = A::Error>,
3136{
3137 type Item = Either11<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item, I::Item, J::Item, K::Item>;
3138 type Error = A::Error;
3139
3140 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
3141 use self::Either11::*;
3142
3143 match *self {
3144 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
3145 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
3146 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
3147 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
3148 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
3149 F(ref mut f) => Ok(try_ready!(f.poll()).map(F).into()),
3150 G(ref mut f) => Ok(try_ready!(f.poll()).map(G).into()),
3151 H(ref mut f) => Ok(try_ready!(f.poll()).map(H).into()),
3152 I(ref mut f) => Ok(try_ready!(f.poll()).map(I).into()),
3153 J(ref mut f) => Ok(try_ready!(f.poll()).map(J).into()),
3154 K(ref mut f) => Ok(try_ready!(f.poll()).map(K).into()),
3155 }
3156 }
3157}
3158
3159impl<A, B, C, D, E, F, G, H, I, J, K> Buf for Either11<A, B, C, D, E, F, G, H, I, J, K>
3160where
3161 A: Buf,
3162 B: Buf,
3163 C: Buf,
3164 D: Buf,
3165 E: Buf,
3166 F: Buf,
3167 G: Buf,
3168 H: Buf,
3169 I: Buf,
3170 J: Buf,
3171 K: Buf,
3172{
3173 fn remaining(&self) -> usize {
3174 use self::Either11::*;
3175
3176 match *self {
3177 A(ref b) => b.remaining(),
3178 B(ref b) => b.remaining(),
3179 C(ref b) => b.remaining(),
3180 D(ref b) => b.remaining(),
3181 E(ref b) => b.remaining(),
3182 F(ref b) => b.remaining(),
3183 G(ref b) => b.remaining(),
3184 H(ref b) => b.remaining(),
3185 I(ref b) => b.remaining(),
3186 J(ref b) => b.remaining(),
3187 K(ref b) => b.remaining(),
3188 }
3189 }
3190
3191 fn bytes(&self) -> &[u8] {
3192 use self::Either11::*;
3193
3194 match *self {
3195 A(ref b) => b.bytes(),
3196 B(ref b) => b.bytes(),
3197 C(ref b) => b.bytes(),
3198 D(ref b) => b.bytes(),
3199 E(ref b) => b.bytes(),
3200 F(ref b) => b.bytes(),
3201 G(ref b) => b.bytes(),
3202 H(ref b) => b.bytes(),
3203 I(ref b) => b.bytes(),
3204 J(ref b) => b.bytes(),
3205 K(ref b) => b.bytes(),
3206 }
3207 }
3208
3209 fn advance(&mut self, cnt: usize) {
3210 use self::Either11::*;
3211
3212 match *self {
3213 A(ref mut b) => b.advance(cnt),
3214 B(ref mut b) => b.advance(cnt),
3215 C(ref mut b) => b.advance(cnt),
3216 D(ref mut b) => b.advance(cnt),
3217 E(ref mut b) => b.advance(cnt),
3218 F(ref mut b) => b.advance(cnt),
3219 G(ref mut b) => b.advance(cnt),
3220 H(ref mut b) => b.advance(cnt),
3221 I(ref mut b) => b.advance(cnt),
3222 J(ref mut b) => b.advance(cnt),
3223 K(ref mut b) => b.advance(cnt),
3224 }
3225 }
3226}
3227
3228impl<A, B, C, D, E, F, G, H, I, J, K> Response for Either11<A, B, C, D, E, F, G, H, I, J, K>
3229where
3230 A: Response,
3231 B: Response,
3232 C: Response,
3233 D: Response,
3234 E: Response,
3235 F: Response,
3236 G: Response,
3237 H: Response,
3238 I: Response,
3239 J: Response,
3240 K: Response,
3241{
3242 type Buf = Either11<A::Buf, B::Buf, C::Buf, D::Buf, E::Buf, F::Buf, G::Buf, H::Buf, I::Buf, J::Buf, K::Buf>;
3243 type Body = Either11<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body, I::Body, J::Body, K::Body>;
3244
3245 fn into_http<S>(self, context: &Context<S>) -> Result<http::Response<Self::Body>, ::Error>
3246 where S: Serializer
3247 {
3248 use self::Either11::*;
3249
3250 match self {
3251 A(r) => Ok(r.into_http(context)?.map(Either11::A)),
3252 B(r) => Ok(r.into_http(context)?.map(Either11::B)),
3253 C(r) => Ok(r.into_http(context)?.map(Either11::C)),
3254 D(r) => Ok(r.into_http(context)?.map(Either11::D)),
3255 E(r) => Ok(r.into_http(context)?.map(Either11::E)),
3256 F(r) => Ok(r.into_http(context)?.map(Either11::F)),
3257 G(r) => Ok(r.into_http(context)?.map(Either11::G)),
3258 H(r) => Ok(r.into_http(context)?.map(Either11::H)),
3259 I(r) => Ok(r.into_http(context)?.map(Either11::I)),
3260 J(r) => Ok(r.into_http(context)?.map(Either11::J)),
3261 K(r) => Ok(r.into_http(context)?.map(Either11::K)),
3262 }
3263 }
3264}
3265
3266impl<R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10> Resource for (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10,)
3267where
3268 R0: Resource,
3269 R1: Resource<RequestBody = R0::RequestBody>,
3270 R2: Resource<RequestBody = R0::RequestBody>,
3271 R3: Resource<RequestBody = R0::RequestBody>,
3272 R4: Resource<RequestBody = R0::RequestBody>,
3273 R5: Resource<RequestBody = R0::RequestBody>,
3274 R6: Resource<RequestBody = R0::RequestBody>,
3275 R7: Resource<RequestBody = R0::RequestBody>,
3276 R8: Resource<RequestBody = R0::RequestBody>,
3277 R9: Resource<RequestBody = R0::RequestBody>,
3278 R10: Resource<RequestBody = R0::RequestBody>,
3279{
3280 type Destination = Either11<R0::Destination, R1::Destination, R2::Destination, R3::Destination, R4::Destination, R5::Destination, R6::Destination, R7::Destination, R8::Destination, R9::Destination, R10::Destination>;
3281 type RequestBody = R0::RequestBody;
3282 type Buf = Either11<R0::Buf, R1::Buf, R2::Buf, R3::Buf, R4::Buf, R5::Buf, R6::Buf, R7::Buf, R8::Buf, R9::Buf, R10::Buf>;
3283 type Body = Either11<R0::Body, R1::Body, R2::Body, R3::Body, R4::Body, R5::Body, R6::Body, R7::Body, R8::Body, R9::Body, R10::Body>;
3284 type Future = Either11<R0::Future, R1::Future, R2::Future, R3::Future, R4::Future, R5::Future, R6::Future, R7::Future, R8::Future, R9::Future, R10::Future>;
3285
3286 fn dispatch(&mut self,
3287 destination: Self::Destination,
3288 route_match: &RouteMatch,
3289 body: Self::RequestBody)
3290 -> Self::Future
3291 {
3292 use self::Either11::*;
3293
3294 match destination {
3295 A(d) => {
3296 A(self.0.dispatch(d, route_match, body))
3297 }
3298 B(d) => {
3299 B(self.1.dispatch(d, route_match, body))
3300 }
3301 C(d) => {
3302 C(self.2.dispatch(d, route_match, body))
3303 }
3304 D(d) => {
3305 D(self.3.dispatch(d, route_match, body))
3306 }
3307 E(d) => {
3308 E(self.4.dispatch(d, route_match, body))
3309 }
3310 F(d) => {
3311 F(self.5.dispatch(d, route_match, body))
3312 }
3313 G(d) => {
3314 G(self.6.dispatch(d, route_match, body))
3315 }
3316 H(d) => {
3317 H(self.7.dispatch(d, route_match, body))
3318 }
3319 I(d) => {
3320 I(self.8.dispatch(d, route_match, body))
3321 }
3322 J(d) => {
3323 J(self.9.dispatch(d, route_match, body))
3324 }
3325 K(d) => {
3326 K(self.10.dispatch(d, route_match, body))
3327 }
3328 }
3329 }
3330}
3331#[derive(Debug, Clone)]
3334pub enum Either12<A, B, C, D, E, F, G, H, I, J, K, L> {
3335 A(A),
3336 B(B),
3337 C(C),
3338 D(D),
3339 E(E),
3340 F(F),
3341 G(G),
3342 H(H),
3343 I(I),
3344 J(J),
3345 K(K),
3346 L(L),
3347}
3348
3349impl<A, B, C, D, E, F, G, H, I, J, K, L> Future for Either12<A, B, C, D, E, F, G, H, I, J, K, L>
3350where
3351 A: Future,
3352 B: Future<Error = A::Error>,
3353 C: Future<Error = A::Error>,
3354 D: Future<Error = A::Error>,
3355 E: Future<Error = A::Error>,
3356 F: Future<Error = A::Error>,
3357 G: Future<Error = A::Error>,
3358 H: Future<Error = A::Error>,
3359 I: Future<Error = A::Error>,
3360 J: Future<Error = A::Error>,
3361 K: Future<Error = A::Error>,
3362 L: Future<Error = A::Error>,
3363{
3364 type Item = Either12<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item, I::Item, J::Item, K::Item, L::Item>;
3365 type Error = A::Error;
3366
3367 fn poll(&mut self) -> Poll<Self::Item, Self::Error> {
3368 use self::Either12::*;
3369
3370 match *self {
3371 A(ref mut f) => Ok(A(try_ready!(f.poll())).into()),
3372 B(ref mut f) => Ok(B(try_ready!(f.poll())).into()),
3373 C(ref mut f) => Ok(C(try_ready!(f.poll())).into()),
3374 D(ref mut f) => Ok(D(try_ready!(f.poll())).into()),
3375 E(ref mut f) => Ok(E(try_ready!(f.poll())).into()),
3376 F(ref mut f) => Ok(F(try_ready!(f.poll())).into()),
3377 G(ref mut f) => Ok(G(try_ready!(f.poll())).into()),
3378 H(ref mut f) => Ok(H(try_ready!(f.poll())).into()),
3379 I(ref mut f) => Ok(I(try_ready!(f.poll())).into()),
3380 J(ref mut f) => Ok(J(try_ready!(f.poll())).into()),
3381 K(ref mut f) => Ok(K(try_ready!(f.poll())).into()),
3382 L(ref mut f) => Ok(L(try_ready!(f.poll())).into()),
3383 }
3384 }
3385}
3386
3387impl<A, B, C, D, E, F, G, H, I, J, K, L> ResourceFuture for Either12<A, B, C, D, E, F, G, H, I, J, K, L>
3388where
3389 A: ResourceFuture,
3390 B: ResourceFuture,
3391 C: ResourceFuture,
3392 D: ResourceFuture,
3393 E: ResourceFuture,
3394 F: ResourceFuture,
3395 G: ResourceFuture,
3396 H: ResourceFuture,
3397 I: ResourceFuture,
3398 J: ResourceFuture,
3399 K: ResourceFuture,
3400 L: ResourceFuture,
3401{
3402 type Body = Either12<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body, I::Body, J::Body, K::Body, L::Body>;
3403
3404 fn poll_response(&mut self, request: &http::Request<()>) -> Poll<http::Response<Self::Body>, ::Error> {
3405 use self::Either12::*;
3406
3407 let response = match *self {
3408 A(ref mut f) => try_ready!(f.poll_response(request)).map(A),
3409 B(ref mut f) => try_ready!(f.poll_response(request)).map(B),
3410 C(ref mut f) => try_ready!(f.poll_response(request)).map(C),
3411 D(ref mut f) => try_ready!(f.poll_response(request)).map(D),
3412 E(ref mut f) => try_ready!(f.poll_response(request)).map(E),
3413 F(ref mut f) => try_ready!(f.poll_response(request)).map(F),
3414 G(ref mut f) => try_ready!(f.poll_response(request)).map(G),
3415 H(ref mut f) => try_ready!(f.poll_response(request)).map(H),
3416 I(ref mut f) => try_ready!(f.poll_response(request)).map(I),
3417 J(ref mut f) => try_ready!(f.poll_response(request)).map(J),
3418 K(ref mut f) => try_ready!(f.poll_response(request)).map(K),
3419 L(ref mut f) => try_ready!(f.poll_response(request)).map(L),
3420 };
3421 Ok(response.into())
3422 }
3423}
3424
3425impl<A, B, C, D, E, F, G, H, I, J, K, L> Either12<A, B, C, D, E, F, G, H, I, J, K, L>
3426where
3427 A: ExtractFuture,
3428 B: ExtractFuture,
3429 C: ExtractFuture,
3430 D: ExtractFuture,
3431 E: ExtractFuture,
3432 F: ExtractFuture,
3433 G: ExtractFuture,
3434 H: ExtractFuture,
3435 I: ExtractFuture,
3436 J: ExtractFuture,
3437 K: ExtractFuture,
3438 L: ExtractFuture,
3439{
3440
3441 pub fn poll_ready(&mut self) -> Poll<(), extract::Error> {
3442 use self::Either12::*;
3443
3444 match *self {
3445 A(ref mut f) => f.poll(),
3446 B(ref mut f) => f.poll(),
3447 C(ref mut f) => f.poll(),
3448 D(ref mut f) => f.poll(),
3449 E(ref mut f) => f.poll(),
3450 F(ref mut f) => f.poll(),
3451 G(ref mut f) => f.poll(),
3452 H(ref mut f) => f.poll(),
3453 I(ref mut f) => f.poll(),
3454 J(ref mut f) => f.poll(),
3455 K(ref mut f) => f.poll(),
3456 L(ref mut f) => f.poll(),
3457 }
3458 }
3459}
3460
3461impl<A, B, C, D, E, F, G, H, I, J, K, L> HttpFuture for Either12<A, B, C, D, E, F, G, H, I, J, K, L>
3462where
3463 A: HttpFuture,
3464 B: HttpFuture,
3465 C: HttpFuture,
3466 D: HttpFuture,
3467 E: HttpFuture,
3468 F: HttpFuture,
3469 G: HttpFuture,
3470 H: HttpFuture,
3471 I: HttpFuture,
3472 J: HttpFuture,
3473 K: HttpFuture,
3474 L: HttpFuture,
3475{
3476 type Body = Either12<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body, I::Body, J::Body, K::Body, L::Body>;
3477
3478 fn poll_http(&mut self) -> Poll<http::Response<Self::Body>, ::Error> {
3479 use self::Either12::*;
3480
3481 match *self {
3482 A(ref mut f) => Ok(try_ready!(f.poll_http()).map(A).into()),
3483 B(ref mut f) => Ok(try_ready!(f.poll_http()).map(B).into()),
3484 C(ref mut f) => Ok(try_ready!(f.poll_http()).map(C).into()),
3485 D(ref mut f) => Ok(try_ready!(f.poll_http()).map(D).into()),
3486 E(ref mut f) => Ok(try_ready!(f.poll_http()).map(E).into()),
3487 F(ref mut f) => Ok(try_ready!(f.poll_http()).map(F).into()),
3488 G(ref mut f) => Ok(try_ready!(f.poll_http()).map(G).into()),
3489 H(ref mut f) => Ok(try_ready!(f.poll_http()).map(H).into()),
3490 I(ref mut f) => Ok(try_ready!(f.poll_http()).map(I).into()),
3491 J(ref mut f) => Ok(try_ready!(f.poll_http()).map(J).into()),
3492 K(ref mut f) => Ok(try_ready!(f.poll_http()).map(K).into()),
3493 L(ref mut f) => Ok(try_ready!(f.poll_http()).map(L).into()),
3494 }
3495 }
3496}
3497
3498impl<A, B, C, D, E, F, G, H, I, J, K, L> SealedFuture for Either12<A, B, C, D, E, F, G, H, I, J, K, L>
3499where
3500 A: HttpFuture,
3501 B: HttpFuture,
3502 C: HttpFuture,
3503 D: HttpFuture,
3504 E: HttpFuture,
3505 F: HttpFuture,
3506 G: HttpFuture,
3507 H: HttpFuture,
3508 I: HttpFuture,
3509 J: HttpFuture,
3510 K: HttpFuture,
3511 L: HttpFuture,
3512{
3513}
3514
3515impl<A, B, C, D, E, F, G, H, I, J, K, L> Stream for Either12<A, B, C, D, E, F, G, H, I, J, K, L>
3516where
3517 A: Stream,
3518 B: Stream<Error = A::Error>,
3519 C: Stream<Error = A::Error>,
3520 D: Stream<Error = A::Error>,
3521 E: Stream<Error = A::Error>,
3522 F: Stream<Error = A::Error>,
3523 G: Stream<Error = A::Error>,
3524 H: Stream<Error = A::Error>,
3525 I: Stream<Error = A::Error>,
3526 J: Stream<Error = A::Error>,
3527 K: Stream<Error = A::Error>,
3528 L: Stream<Error = A::Error>,
3529{
3530 type Item = Either12<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item, I::Item, J::Item, K::Item, L::Item>;
3531 type Error = A::Error;
3532
3533 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
3534 use self::Either12::*;
3535
3536 match *self {
3537 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
3538 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
3539 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
3540 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
3541 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
3542 F(ref mut f) => Ok(try_ready!(f.poll()).map(F).into()),
3543 G(ref mut f) => Ok(try_ready!(f.poll()).map(G).into()),
3544 H(ref mut f) => Ok(try_ready!(f.poll()).map(H).into()),
3545 I(ref mut f) => Ok(try_ready!(f.poll()).map(I).into()),
3546 J(ref mut f) => Ok(try_ready!(f.poll()).map(J).into()),
3547 K(ref mut f) => Ok(try_ready!(f.poll()).map(K).into()),
3548 L(ref mut f) => Ok(try_ready!(f.poll()).map(L).into()),
3549 }
3550 }
3551}
3552
3553impl<A, B, C, D, E, F, G, H, I, J, K, L> BufStream for Either12<A, B, C, D, E, F, G, H, I, J, K, L>
3554where
3555 A: BufStream,
3556 B: BufStream<Error = A::Error>,
3557 C: BufStream<Error = A::Error>,
3558 D: BufStream<Error = A::Error>,
3559 E: BufStream<Error = A::Error>,
3560 F: BufStream<Error = A::Error>,
3561 G: BufStream<Error = A::Error>,
3562 H: BufStream<Error = A::Error>,
3563 I: BufStream<Error = A::Error>,
3564 J: BufStream<Error = A::Error>,
3565 K: BufStream<Error = A::Error>,
3566 L: BufStream<Error = A::Error>,
3567{
3568 type Item = Either12<A::Item, B::Item, C::Item, D::Item, E::Item, F::Item, G::Item, H::Item, I::Item, J::Item, K::Item, L::Item>;
3569 type Error = A::Error;
3570
3571 fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
3572 use self::Either12::*;
3573
3574 match *self {
3575 A(ref mut f) => Ok(try_ready!(f.poll()).map(A).into()),
3576 B(ref mut f) => Ok(try_ready!(f.poll()).map(B).into()),
3577 C(ref mut f) => Ok(try_ready!(f.poll()).map(C).into()),
3578 D(ref mut f) => Ok(try_ready!(f.poll()).map(D).into()),
3579 E(ref mut f) => Ok(try_ready!(f.poll()).map(E).into()),
3580 F(ref mut f) => Ok(try_ready!(f.poll()).map(F).into()),
3581 G(ref mut f) => Ok(try_ready!(f.poll()).map(G).into()),
3582 H(ref mut f) => Ok(try_ready!(f.poll()).map(H).into()),
3583 I(ref mut f) => Ok(try_ready!(f.poll()).map(I).into()),
3584 J(ref mut f) => Ok(try_ready!(f.poll()).map(J).into()),
3585 K(ref mut f) => Ok(try_ready!(f.poll()).map(K).into()),
3586 L(ref mut f) => Ok(try_ready!(f.poll()).map(L).into()),
3587 }
3588 }
3589}
3590
3591impl<A, B, C, D, E, F, G, H, I, J, K, L> Buf for Either12<A, B, C, D, E, F, G, H, I, J, K, L>
3592where
3593 A: Buf,
3594 B: Buf,
3595 C: Buf,
3596 D: Buf,
3597 E: Buf,
3598 F: Buf,
3599 G: Buf,
3600 H: Buf,
3601 I: Buf,
3602 J: Buf,
3603 K: Buf,
3604 L: Buf,
3605{
3606 fn remaining(&self) -> usize {
3607 use self::Either12::*;
3608
3609 match *self {
3610 A(ref b) => b.remaining(),
3611 B(ref b) => b.remaining(),
3612 C(ref b) => b.remaining(),
3613 D(ref b) => b.remaining(),
3614 E(ref b) => b.remaining(),
3615 F(ref b) => b.remaining(),
3616 G(ref b) => b.remaining(),
3617 H(ref b) => b.remaining(),
3618 I(ref b) => b.remaining(),
3619 J(ref b) => b.remaining(),
3620 K(ref b) => b.remaining(),
3621 L(ref b) => b.remaining(),
3622 }
3623 }
3624
3625 fn bytes(&self) -> &[u8] {
3626 use self::Either12::*;
3627
3628 match *self {
3629 A(ref b) => b.bytes(),
3630 B(ref b) => b.bytes(),
3631 C(ref b) => b.bytes(),
3632 D(ref b) => b.bytes(),
3633 E(ref b) => b.bytes(),
3634 F(ref b) => b.bytes(),
3635 G(ref b) => b.bytes(),
3636 H(ref b) => b.bytes(),
3637 I(ref b) => b.bytes(),
3638 J(ref b) => b.bytes(),
3639 K(ref b) => b.bytes(),
3640 L(ref b) => b.bytes(),
3641 }
3642 }
3643
3644 fn advance(&mut self, cnt: usize) {
3645 use self::Either12::*;
3646
3647 match *self {
3648 A(ref mut b) => b.advance(cnt),
3649 B(ref mut b) => b.advance(cnt),
3650 C(ref mut b) => b.advance(cnt),
3651 D(ref mut b) => b.advance(cnt),
3652 E(ref mut b) => b.advance(cnt),
3653 F(ref mut b) => b.advance(cnt),
3654 G(ref mut b) => b.advance(cnt),
3655 H(ref mut b) => b.advance(cnt),
3656 I(ref mut b) => b.advance(cnt),
3657 J(ref mut b) => b.advance(cnt),
3658 K(ref mut b) => b.advance(cnt),
3659 L(ref mut b) => b.advance(cnt),
3660 }
3661 }
3662}
3663
3664impl<A, B, C, D, E, F, G, H, I, J, K, L> Response for Either12<A, B, C, D, E, F, G, H, I, J, K, L>
3665where
3666 A: Response,
3667 B: Response,
3668 C: Response,
3669 D: Response,
3670 E: Response,
3671 F: Response,
3672 G: Response,
3673 H: Response,
3674 I: Response,
3675 J: Response,
3676 K: Response,
3677 L: Response,
3678{
3679 type Buf = Either12<A::Buf, B::Buf, C::Buf, D::Buf, E::Buf, F::Buf, G::Buf, H::Buf, I::Buf, J::Buf, K::Buf, L::Buf>;
3680 type Body = Either12<A::Body, B::Body, C::Body, D::Body, E::Body, F::Body, G::Body, H::Body, I::Body, J::Body, K::Body, L::Body>;
3681
3682 fn into_http<S>(self, context: &Context<S>) -> Result<http::Response<Self::Body>, ::Error>
3683 where S: Serializer
3684 {
3685 use self::Either12::*;
3686
3687 match self {
3688 A(r) => Ok(r.into_http(context)?.map(Either12::A)),
3689 B(r) => Ok(r.into_http(context)?.map(Either12::B)),
3690 C(r) => Ok(r.into_http(context)?.map(Either12::C)),
3691 D(r) => Ok(r.into_http(context)?.map(Either12::D)),
3692 E(r) => Ok(r.into_http(context)?.map(Either12::E)),
3693 F(r) => Ok(r.into_http(context)?.map(Either12::F)),
3694 G(r) => Ok(r.into_http(context)?.map(Either12::G)),
3695 H(r) => Ok(r.into_http(context)?.map(Either12::H)),
3696 I(r) => Ok(r.into_http(context)?.map(Either12::I)),
3697 J(r) => Ok(r.into_http(context)?.map(Either12::J)),
3698 K(r) => Ok(r.into_http(context)?.map(Either12::K)),
3699 L(r) => Ok(r.into_http(context)?.map(Either12::L)),
3700 }
3701 }
3702}
3703
3704impl<R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11> Resource for (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11,)
3705where
3706 R0: Resource,
3707 R1: Resource<RequestBody = R0::RequestBody>,
3708 R2: Resource<RequestBody = R0::RequestBody>,
3709 R3: Resource<RequestBody = R0::RequestBody>,
3710 R4: Resource<RequestBody = R0::RequestBody>,
3711 R5: Resource<RequestBody = R0::RequestBody>,
3712 R6: Resource<RequestBody = R0::RequestBody>,
3713 R7: Resource<RequestBody = R0::RequestBody>,
3714 R8: Resource<RequestBody = R0::RequestBody>,
3715 R9: Resource<RequestBody = R0::RequestBody>,
3716 R10: Resource<RequestBody = R0::RequestBody>,
3717 R11: Resource<RequestBody = R0::RequestBody>,
3718{
3719 type Destination = Either12<R0::Destination, R1::Destination, R2::Destination, R3::Destination, R4::Destination, R5::Destination, R6::Destination, R7::Destination, R8::Destination, R9::Destination, R10::Destination, R11::Destination>;
3720 type RequestBody = R0::RequestBody;
3721 type Buf = Either12<R0::Buf, R1::Buf, R2::Buf, R3::Buf, R4::Buf, R5::Buf, R6::Buf, R7::Buf, R8::Buf, R9::Buf, R10::Buf, R11::Buf>;
3722 type Body = Either12<R0::Body, R1::Body, R2::Body, R3::Body, R4::Body, R5::Body, R6::Body, R7::Body, R8::Body, R9::Body, R10::Body, R11::Body>;
3723 type Future = Either12<R0::Future, R1::Future, R2::Future, R3::Future, R4::Future, R5::Future, R6::Future, R7::Future, R8::Future, R9::Future, R10::Future, R11::Future>;
3724
3725 fn dispatch(&mut self,
3726 destination: Self::Destination,
3727 route_match: &RouteMatch,
3728 body: Self::RequestBody)
3729 -> Self::Future
3730 {
3731 use self::Either12::*;
3732
3733 match destination {
3734 A(d) => {
3735 A(self.0.dispatch(d, route_match, body))
3736 }
3737 B(d) => {
3738 B(self.1.dispatch(d, route_match, body))
3739 }
3740 C(d) => {
3741 C(self.2.dispatch(d, route_match, body))
3742 }
3743 D(d) => {
3744 D(self.3.dispatch(d, route_match, body))
3745 }
3746 E(d) => {
3747 E(self.4.dispatch(d, route_match, body))
3748 }
3749 F(d) => {
3750 F(self.5.dispatch(d, route_match, body))
3751 }
3752 G(d) => {
3753 G(self.6.dispatch(d, route_match, body))
3754 }
3755 H(d) => {
3756 H(self.7.dispatch(d, route_match, body))
3757 }
3758 I(d) => {
3759 I(self.8.dispatch(d, route_match, body))
3760 }
3761 J(d) => {
3762 J(self.9.dispatch(d, route_match, body))
3763 }
3764 K(d) => {
3765 K(self.10.dispatch(d, route_match, body))
3766 }
3767 L(d) => {
3768 L(self.11.dispatch(d, route_match, body))
3769 }
3770 }
3771 }
3772}
3773
3774impl<R0, U> Chain<U> for (R0,) {
3775 type Output = (R0, U);
3776
3777 fn chain(self, other: U) -> Self::Output {
3778 (self.0, other)
3779 }
3780}
3781
3782#[derive(Debug)]
3783pub struct Join1<T0> {
3784 futures: (T0,),
3785 pending: (bool,),
3786}
3787
3788impl<T0> Join1<T0>
3789where
3790 T0: ExtractFuture,
3791{
3792 pub fn new(t0: T0) -> Self {
3793 Self {
3794 pending: (false, ),
3795 futures: (t0, ),
3796 }
3797 }
3798
3799 pub fn into_inner(self) -> (T0,)
3800 {
3801 self.futures
3802 }
3803}
3804
3805impl<T0> Future for Join1<T0>
3806where
3807 T0: ExtractFuture,
3808{
3809 type Item = ();
3810 type Error = extract::Error;
3811
3812 fn poll(&mut self) -> Poll<(), extract::Error> {
3813 let mut all_ready = true;
3814
3815 if !self.pending.0 {
3816 self.pending.0 = self.futures.0.poll()?.is_ready();
3817 all_ready &= self.pending.0;
3818 }
3819 Ok(if all_ready { Async::Ready(()) } else { Async::NotReady })
3820 }
3821}
3822impl<S: Serializer, B: BufStream, T0> IntoResource<S, B> for (T0,)
3823where
3824 T0: IntoResource<S, B>,
3825{
3826 type Destination = Either1<T0::Destination>;
3827 type Resource = (T0::Resource,);
3828
3829 fn routes(&self) -> RouteSet<Self::Destination>
3830 {
3831 let mut routes = routing::Builder::new();
3832
3833 routes.insert_all(self.0.routes().map(Either1::A));
3834 routes.build()
3835 }
3836
3837 fn into_resource(self, serializer: S) -> Self::Resource {
3838 (
3839 self.0.into_resource(serializer.clone()),
3840 )
3841 }
3842}
3843impl<R0, R1, U> Chain<U> for (R0, R1,) {
3844 type Output = (R0, R1, U);
3845
3846 fn chain(self, other: U) -> Self::Output {
3847 (self.0, self.1, other)
3848 }
3849}
3850
3851#[derive(Debug)]
3852pub struct Join2<T0, T1> {
3853 futures: (T0, T1,),
3854 pending: (bool, bool,),
3855}
3856
3857impl<T0, T1> Join2<T0, T1>
3858where
3859 T0: ExtractFuture,
3860 T1: ExtractFuture,
3861{
3862 pub fn new(t0: T0, t1: T1) -> Self {
3863 Self {
3864 pending: (false, false, ),
3865 futures: (t0, t1, ),
3866 }
3867 }
3868
3869 pub fn into_inner(self) -> (T0, T1,)
3870 {
3871 self.futures
3872 }
3873}
3874
3875impl<T0, T1> Future for Join2<T0, T1>
3876where
3877 T0: ExtractFuture,
3878 T1: ExtractFuture,
3879{
3880 type Item = ();
3881 type Error = extract::Error;
3882
3883 fn poll(&mut self) -> Poll<(), extract::Error> {
3884 let mut all_ready = true;
3885
3886 if !self.pending.0 {
3887 self.pending.0 = self.futures.0.poll()?.is_ready();
3888 all_ready &= self.pending.0;
3889 }
3890 if !self.pending.1 {
3891 self.pending.1 = self.futures.1.poll()?.is_ready();
3892 all_ready &= self.pending.1;
3893 }
3894 Ok(if all_ready { Async::Ready(()) } else { Async::NotReady })
3895 }
3896}
3897impl<S: Serializer, B: BufStream, T0, T1> IntoResource<S, B> for (T0, T1,)
3898where
3899 T0: IntoResource<S, B>,
3900 T1: IntoResource<S, B>,
3901{
3902 type Destination = Either2<T0::Destination, T1::Destination>;
3903 type Resource = (T0::Resource, T1::Resource,);
3904
3905 fn routes(&self) -> RouteSet<Self::Destination>
3906 {
3907 let mut routes = routing::Builder::new();
3908
3909 routes.insert_all(self.0.routes().map(Either2::A));
3910 routes.insert_all(self.1.routes().map(Either2::B));
3911 routes.build()
3912 }
3913
3914 fn into_resource(self, serializer: S) -> Self::Resource {
3915 (
3916 self.0.into_resource(serializer.clone()),
3917 self.1.into_resource(serializer.clone()),
3918 )
3919 }
3920}
3921impl<R0, R1, R2, U> Chain<U> for (R0, R1, R2,) {
3922 type Output = (R0, R1, R2, U);
3923
3924 fn chain(self, other: U) -> Self::Output {
3925 (self.0, self.1, self.2, other)
3926 }
3927}
3928
3929#[derive(Debug)]
3930pub struct Join3<T0, T1, T2> {
3931 futures: (T0, T1, T2,),
3932 pending: (bool, bool, bool,),
3933}
3934
3935impl<T0, T1, T2> Join3<T0, T1, T2>
3936where
3937 T0: ExtractFuture,
3938 T1: ExtractFuture,
3939 T2: ExtractFuture,
3940{
3941 pub fn new(t0: T0, t1: T1, t2: T2) -> Self {
3942 Self {
3943 pending: (false, false, false, ),
3944 futures: (t0, t1, t2, ),
3945 }
3946 }
3947
3948 pub fn into_inner(self) -> (T0, T1, T2,)
3949 {
3950 self.futures
3951 }
3952}
3953
3954impl<T0, T1, T2> Future for Join3<T0, T1, T2>
3955where
3956 T0: ExtractFuture,
3957 T1: ExtractFuture,
3958 T2: ExtractFuture,
3959{
3960 type Item = ();
3961 type Error = extract::Error;
3962
3963 fn poll(&mut self) -> Poll<(), extract::Error> {
3964 let mut all_ready = true;
3965
3966 if !self.pending.0 {
3967 self.pending.0 = self.futures.0.poll()?.is_ready();
3968 all_ready &= self.pending.0;
3969 }
3970 if !self.pending.1 {
3971 self.pending.1 = self.futures.1.poll()?.is_ready();
3972 all_ready &= self.pending.1;
3973 }
3974 if !self.pending.2 {
3975 self.pending.2 = self.futures.2.poll()?.is_ready();
3976 all_ready &= self.pending.2;
3977 }
3978 Ok(if all_ready { Async::Ready(()) } else { Async::NotReady })
3979 }
3980}
3981impl<S: Serializer, B: BufStream, T0, T1, T2> IntoResource<S, B> for (T0, T1, T2,)
3982where
3983 T0: IntoResource<S, B>,
3984 T1: IntoResource<S, B>,
3985 T2: IntoResource<S, B>,
3986{
3987 type Destination = Either3<T0::Destination, T1::Destination, T2::Destination>;
3988 type Resource = (T0::Resource, T1::Resource, T2::Resource,);
3989
3990 fn routes(&self) -> RouteSet<Self::Destination>
3991 {
3992 let mut routes = routing::Builder::new();
3993
3994 routes.insert_all(self.0.routes().map(Either3::A));
3995 routes.insert_all(self.1.routes().map(Either3::B));
3996 routes.insert_all(self.2.routes().map(Either3::C));
3997 routes.build()
3998 }
3999
4000 fn into_resource(self, serializer: S) -> Self::Resource {
4001 (
4002 self.0.into_resource(serializer.clone()),
4003 self.1.into_resource(serializer.clone()),
4004 self.2.into_resource(serializer.clone()),
4005 )
4006 }
4007}
4008impl<R0, R1, R2, R3, U> Chain<U> for (R0, R1, R2, R3,) {
4009 type Output = (R0, R1, R2, R3, U);
4010
4011 fn chain(self, other: U) -> Self::Output {
4012 (self.0, self.1, self.2, self.3, other)
4013 }
4014}
4015
4016#[derive(Debug)]
4017pub struct Join4<T0, T1, T2, T3> {
4018 futures: (T0, T1, T2, T3,),
4019 pending: (bool, bool, bool, bool,),
4020}
4021
4022impl<T0, T1, T2, T3> Join4<T0, T1, T2, T3>
4023where
4024 T0: ExtractFuture,
4025 T1: ExtractFuture,
4026 T2: ExtractFuture,
4027 T3: ExtractFuture,
4028{
4029 pub fn new(t0: T0, t1: T1, t2: T2, t3: T3) -> Self {
4030 Self {
4031 pending: (false, false, false, false, ),
4032 futures: (t0, t1, t2, t3, ),
4033 }
4034 }
4035
4036 pub fn into_inner(self) -> (T0, T1, T2, T3,)
4037 {
4038 self.futures
4039 }
4040}
4041
4042impl<T0, T1, T2, T3> Future for Join4<T0, T1, T2, T3>
4043where
4044 T0: ExtractFuture,
4045 T1: ExtractFuture,
4046 T2: ExtractFuture,
4047 T3: ExtractFuture,
4048{
4049 type Item = ();
4050 type Error = extract::Error;
4051
4052 fn poll(&mut self) -> Poll<(), extract::Error> {
4053 let mut all_ready = true;
4054
4055 if !self.pending.0 {
4056 self.pending.0 = self.futures.0.poll()?.is_ready();
4057 all_ready &= self.pending.0;
4058 }
4059 if !self.pending.1 {
4060 self.pending.1 = self.futures.1.poll()?.is_ready();
4061 all_ready &= self.pending.1;
4062 }
4063 if !self.pending.2 {
4064 self.pending.2 = self.futures.2.poll()?.is_ready();
4065 all_ready &= self.pending.2;
4066 }
4067 if !self.pending.3 {
4068 self.pending.3 = self.futures.3.poll()?.is_ready();
4069 all_ready &= self.pending.3;
4070 }
4071 Ok(if all_ready { Async::Ready(()) } else { Async::NotReady })
4072 }
4073}
4074impl<S: Serializer, B: BufStream, T0, T1, T2, T3> IntoResource<S, B> for (T0, T1, T2, T3,)
4075where
4076 T0: IntoResource<S, B>,
4077 T1: IntoResource<S, B>,
4078 T2: IntoResource<S, B>,
4079 T3: IntoResource<S, B>,
4080{
4081 type Destination = Either4<T0::Destination, T1::Destination, T2::Destination, T3::Destination>;
4082 type Resource = (T0::Resource, T1::Resource, T2::Resource, T3::Resource,);
4083
4084 fn routes(&self) -> RouteSet<Self::Destination>
4085 {
4086 let mut routes = routing::Builder::new();
4087
4088 routes.insert_all(self.0.routes().map(Either4::A));
4089 routes.insert_all(self.1.routes().map(Either4::B));
4090 routes.insert_all(self.2.routes().map(Either4::C));
4091 routes.insert_all(self.3.routes().map(Either4::D));
4092 routes.build()
4093 }
4094
4095 fn into_resource(self, serializer: S) -> Self::Resource {
4096 (
4097 self.0.into_resource(serializer.clone()),
4098 self.1.into_resource(serializer.clone()),
4099 self.2.into_resource(serializer.clone()),
4100 self.3.into_resource(serializer.clone()),
4101 )
4102 }
4103}
4104impl<R0, R1, R2, R3, R4, U> Chain<U> for (R0, R1, R2, R3, R4,) {
4105 type Output = (R0, R1, R2, R3, R4, U);
4106
4107 fn chain(self, other: U) -> Self::Output {
4108 (self.0, self.1, self.2, self.3, self.4, other)
4109 }
4110}
4111
4112#[derive(Debug)]
4113pub struct Join5<T0, T1, T2, T3, T4> {
4114 futures: (T0, T1, T2, T3, T4,),
4115 pending: (bool, bool, bool, bool, bool,),
4116}
4117
4118impl<T0, T1, T2, T3, T4> Join5<T0, T1, T2, T3, T4>
4119where
4120 T0: ExtractFuture,
4121 T1: ExtractFuture,
4122 T2: ExtractFuture,
4123 T3: ExtractFuture,
4124 T4: ExtractFuture,
4125{
4126 pub fn new(t0: T0, t1: T1, t2: T2, t3: T3, t4: T4) -> Self {
4127 Self {
4128 pending: (false, false, false, false, false, ),
4129 futures: (t0, t1, t2, t3, t4, ),
4130 }
4131 }
4132
4133 pub fn into_inner(self) -> (T0, T1, T2, T3, T4,)
4134 {
4135 self.futures
4136 }
4137}
4138
4139impl<T0, T1, T2, T3, T4> Future for Join5<T0, T1, T2, T3, T4>
4140where
4141 T0: ExtractFuture,
4142 T1: ExtractFuture,
4143 T2: ExtractFuture,
4144 T3: ExtractFuture,
4145 T4: ExtractFuture,
4146{
4147 type Item = ();
4148 type Error = extract::Error;
4149
4150 fn poll(&mut self) -> Poll<(), extract::Error> {
4151 let mut all_ready = true;
4152
4153 if !self.pending.0 {
4154 self.pending.0 = self.futures.0.poll()?.is_ready();
4155 all_ready &= self.pending.0;
4156 }
4157 if !self.pending.1 {
4158 self.pending.1 = self.futures.1.poll()?.is_ready();
4159 all_ready &= self.pending.1;
4160 }
4161 if !self.pending.2 {
4162 self.pending.2 = self.futures.2.poll()?.is_ready();
4163 all_ready &= self.pending.2;
4164 }
4165 if !self.pending.3 {
4166 self.pending.3 = self.futures.3.poll()?.is_ready();
4167 all_ready &= self.pending.3;
4168 }
4169 if !self.pending.4 {
4170 self.pending.4 = self.futures.4.poll()?.is_ready();
4171 all_ready &= self.pending.4;
4172 }
4173 Ok(if all_ready { Async::Ready(()) } else { Async::NotReady })
4174 }
4175}
4176impl<S: Serializer, B: BufStream, T0, T1, T2, T3, T4> IntoResource<S, B> for (T0, T1, T2, T3, T4,)
4177where
4178 T0: IntoResource<S, B>,
4179 T1: IntoResource<S, B>,
4180 T2: IntoResource<S, B>,
4181 T3: IntoResource<S, B>,
4182 T4: IntoResource<S, B>,
4183{
4184 type Destination = Either5<T0::Destination, T1::Destination, T2::Destination, T3::Destination, T4::Destination>;
4185 type Resource = (T0::Resource, T1::Resource, T2::Resource, T3::Resource, T4::Resource,);
4186
4187 fn routes(&self) -> RouteSet<Self::Destination>
4188 {
4189 let mut routes = routing::Builder::new();
4190
4191 routes.insert_all(self.0.routes().map(Either5::A));
4192 routes.insert_all(self.1.routes().map(Either5::B));
4193 routes.insert_all(self.2.routes().map(Either5::C));
4194 routes.insert_all(self.3.routes().map(Either5::D));
4195 routes.insert_all(self.4.routes().map(Either5::E));
4196 routes.build()
4197 }
4198
4199 fn into_resource(self, serializer: S) -> Self::Resource {
4200 (
4201 self.0.into_resource(serializer.clone()),
4202 self.1.into_resource(serializer.clone()),
4203 self.2.into_resource(serializer.clone()),
4204 self.3.into_resource(serializer.clone()),
4205 self.4.into_resource(serializer.clone()),
4206 )
4207 }
4208}
4209impl<R0, R1, R2, R3, R4, R5, U> Chain<U> for (R0, R1, R2, R3, R4, R5,) {
4210 type Output = (R0, R1, R2, R3, R4, R5, U);
4211
4212 fn chain(self, other: U) -> Self::Output {
4213 (self.0, self.1, self.2, self.3, self.4, self.5, other)
4214 }
4215}
4216
4217#[derive(Debug)]
4218pub struct Join6<T0, T1, T2, T3, T4, T5> {
4219 futures: (T0, T1, T2, T3, T4, T5,),
4220 pending: (bool, bool, bool, bool, bool, bool,),
4221}
4222
4223impl<T0, T1, T2, T3, T4, T5> Join6<T0, T1, T2, T3, T4, T5>
4224where
4225 T0: ExtractFuture,
4226 T1: ExtractFuture,
4227 T2: ExtractFuture,
4228 T3: ExtractFuture,
4229 T4: ExtractFuture,
4230 T5: ExtractFuture,
4231{
4232 pub fn new(t0: T0, t1: T1, t2: T2, t3: T3, t4: T4, t5: T5) -> Self {
4233 Self {
4234 pending: (false, false, false, false, false, false, ),
4235 futures: (t0, t1, t2, t3, t4, t5, ),
4236 }
4237 }
4238
4239 pub fn into_inner(self) -> (T0, T1, T2, T3, T4, T5,)
4240 {
4241 self.futures
4242 }
4243}
4244
4245impl<T0, T1, T2, T3, T4, T5> Future for Join6<T0, T1, T2, T3, T4, T5>
4246where
4247 T0: ExtractFuture,
4248 T1: ExtractFuture,
4249 T2: ExtractFuture,
4250 T3: ExtractFuture,
4251 T4: ExtractFuture,
4252 T5: ExtractFuture,
4253{
4254 type Item = ();
4255 type Error = extract::Error;
4256
4257 fn poll(&mut self) -> Poll<(), extract::Error> {
4258 let mut all_ready = true;
4259
4260 if !self.pending.0 {
4261 self.pending.0 = self.futures.0.poll()?.is_ready();
4262 all_ready &= self.pending.0;
4263 }
4264 if !self.pending.1 {
4265 self.pending.1 = self.futures.1.poll()?.is_ready();
4266 all_ready &= self.pending.1;
4267 }
4268 if !self.pending.2 {
4269 self.pending.2 = self.futures.2.poll()?.is_ready();
4270 all_ready &= self.pending.2;
4271 }
4272 if !self.pending.3 {
4273 self.pending.3 = self.futures.3.poll()?.is_ready();
4274 all_ready &= self.pending.3;
4275 }
4276 if !self.pending.4 {
4277 self.pending.4 = self.futures.4.poll()?.is_ready();
4278 all_ready &= self.pending.4;
4279 }
4280 if !self.pending.5 {
4281 self.pending.5 = self.futures.5.poll()?.is_ready();
4282 all_ready &= self.pending.5;
4283 }
4284 Ok(if all_ready { Async::Ready(()) } else { Async::NotReady })
4285 }
4286}
4287impl<S: Serializer, B: BufStream, T0, T1, T2, T3, T4, T5> IntoResource<S, B> for (T0, T1, T2, T3, T4, T5,)
4288where
4289 T0: IntoResource<S, B>,
4290 T1: IntoResource<S, B>,
4291 T2: IntoResource<S, B>,
4292 T3: IntoResource<S, B>,
4293 T4: IntoResource<S, B>,
4294 T5: IntoResource<S, B>,
4295{
4296 type Destination = Either6<T0::Destination, T1::Destination, T2::Destination, T3::Destination, T4::Destination, T5::Destination>;
4297 type Resource = (T0::Resource, T1::Resource, T2::Resource, T3::Resource, T4::Resource, T5::Resource,);
4298
4299 fn routes(&self) -> RouteSet<Self::Destination>
4300 {
4301 let mut routes = routing::Builder::new();
4302
4303 routes.insert_all(self.0.routes().map(Either6::A));
4304 routes.insert_all(self.1.routes().map(Either6::B));
4305 routes.insert_all(self.2.routes().map(Either6::C));
4306 routes.insert_all(self.3.routes().map(Either6::D));
4307 routes.insert_all(self.4.routes().map(Either6::E));
4308 routes.insert_all(self.5.routes().map(Either6::F));
4309 routes.build()
4310 }
4311
4312 fn into_resource(self, serializer: S) -> Self::Resource {
4313 (
4314 self.0.into_resource(serializer.clone()),
4315 self.1.into_resource(serializer.clone()),
4316 self.2.into_resource(serializer.clone()),
4317 self.3.into_resource(serializer.clone()),
4318 self.4.into_resource(serializer.clone()),
4319 self.5.into_resource(serializer.clone()),
4320 )
4321 }
4322}
4323impl<R0, R1, R2, R3, R4, R5, R6, U> Chain<U> for (R0, R1, R2, R3, R4, R5, R6,) {
4324 type Output = (R0, R1, R2, R3, R4, R5, R6, U);
4325
4326 fn chain(self, other: U) -> Self::Output {
4327 (self.0, self.1, self.2, self.3, self.4, self.5, self.6, other)
4328 }
4329}
4330
4331#[derive(Debug)]
4332pub struct Join7<T0, T1, T2, T3, T4, T5, T6> {
4333 futures: (T0, T1, T2, T3, T4, T5, T6,),
4334 pending: (bool, bool, bool, bool, bool, bool, bool,),
4335}
4336
4337impl<T0, T1, T2, T3, T4, T5, T6> Join7<T0, T1, T2, T3, T4, T5, T6>
4338where
4339 T0: ExtractFuture,
4340 T1: ExtractFuture,
4341 T2: ExtractFuture,
4342 T3: ExtractFuture,
4343 T4: ExtractFuture,
4344 T5: ExtractFuture,
4345 T6: ExtractFuture,
4346{
4347 pub fn new(t0: T0, t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6) -> Self {
4348 Self {
4349 pending: (false, false, false, false, false, false, false, ),
4350 futures: (t0, t1, t2, t3, t4, t5, t6, ),
4351 }
4352 }
4353
4354 pub fn into_inner(self) -> (T0, T1, T2, T3, T4, T5, T6,)
4355 {
4356 self.futures
4357 }
4358}
4359
4360impl<T0, T1, T2, T3, T4, T5, T6> Future for Join7<T0, T1, T2, T3, T4, T5, T6>
4361where
4362 T0: ExtractFuture,
4363 T1: ExtractFuture,
4364 T2: ExtractFuture,
4365 T3: ExtractFuture,
4366 T4: ExtractFuture,
4367 T5: ExtractFuture,
4368 T6: ExtractFuture,
4369{
4370 type Item = ();
4371 type Error = extract::Error;
4372
4373 fn poll(&mut self) -> Poll<(), extract::Error> {
4374 let mut all_ready = true;
4375
4376 if !self.pending.0 {
4377 self.pending.0 = self.futures.0.poll()?.is_ready();
4378 all_ready &= self.pending.0;
4379 }
4380 if !self.pending.1 {
4381 self.pending.1 = self.futures.1.poll()?.is_ready();
4382 all_ready &= self.pending.1;
4383 }
4384 if !self.pending.2 {
4385 self.pending.2 = self.futures.2.poll()?.is_ready();
4386 all_ready &= self.pending.2;
4387 }
4388 if !self.pending.3 {
4389 self.pending.3 = self.futures.3.poll()?.is_ready();
4390 all_ready &= self.pending.3;
4391 }
4392 if !self.pending.4 {
4393 self.pending.4 = self.futures.4.poll()?.is_ready();
4394 all_ready &= self.pending.4;
4395 }
4396 if !self.pending.5 {
4397 self.pending.5 = self.futures.5.poll()?.is_ready();
4398 all_ready &= self.pending.5;
4399 }
4400 if !self.pending.6 {
4401 self.pending.6 = self.futures.6.poll()?.is_ready();
4402 all_ready &= self.pending.6;
4403 }
4404 Ok(if all_ready { Async::Ready(()) } else { Async::NotReady })
4405 }
4406}
4407impl<S: Serializer, B: BufStream, T0, T1, T2, T3, T4, T5, T6> IntoResource<S, B> for (T0, T1, T2, T3, T4, T5, T6,)
4408where
4409 T0: IntoResource<S, B>,
4410 T1: IntoResource<S, B>,
4411 T2: IntoResource<S, B>,
4412 T3: IntoResource<S, B>,
4413 T4: IntoResource<S, B>,
4414 T5: IntoResource<S, B>,
4415 T6: IntoResource<S, B>,
4416{
4417 type Destination = Either7<T0::Destination, T1::Destination, T2::Destination, T3::Destination, T4::Destination, T5::Destination, T6::Destination>;
4418 type Resource = (T0::Resource, T1::Resource, T2::Resource, T3::Resource, T4::Resource, T5::Resource, T6::Resource,);
4419
4420 fn routes(&self) -> RouteSet<Self::Destination>
4421 {
4422 let mut routes = routing::Builder::new();
4423
4424 routes.insert_all(self.0.routes().map(Either7::A));
4425 routes.insert_all(self.1.routes().map(Either7::B));
4426 routes.insert_all(self.2.routes().map(Either7::C));
4427 routes.insert_all(self.3.routes().map(Either7::D));
4428 routes.insert_all(self.4.routes().map(Either7::E));
4429 routes.insert_all(self.5.routes().map(Either7::F));
4430 routes.insert_all(self.6.routes().map(Either7::G));
4431 routes.build()
4432 }
4433
4434 fn into_resource(self, serializer: S) -> Self::Resource {
4435 (
4436 self.0.into_resource(serializer.clone()),
4437 self.1.into_resource(serializer.clone()),
4438 self.2.into_resource(serializer.clone()),
4439 self.3.into_resource(serializer.clone()),
4440 self.4.into_resource(serializer.clone()),
4441 self.5.into_resource(serializer.clone()),
4442 self.6.into_resource(serializer.clone()),
4443 )
4444 }
4445}
4446impl<R0, R1, R2, R3, R4, R5, R6, R7, U> Chain<U> for (R0, R1, R2, R3, R4, R5, R6, R7,) {
4447 type Output = (R0, R1, R2, R3, R4, R5, R6, R7, U);
4448
4449 fn chain(self, other: U) -> Self::Output {
4450 (self.0, self.1, self.2, self.3, self.4, self.5, self.6, self.7, other)
4451 }
4452}
4453
4454#[derive(Debug)]
4455pub struct Join8<T0, T1, T2, T3, T4, T5, T6, T7> {
4456 futures: (T0, T1, T2, T3, T4, T5, T6, T7,),
4457 pending: (bool, bool, bool, bool, bool, bool, bool, bool,),
4458}
4459
4460impl<T0, T1, T2, T3, T4, T5, T6, T7> Join8<T0, T1, T2, T3, T4, T5, T6, T7>
4461where
4462 T0: ExtractFuture,
4463 T1: ExtractFuture,
4464 T2: ExtractFuture,
4465 T3: ExtractFuture,
4466 T4: ExtractFuture,
4467 T5: ExtractFuture,
4468 T6: ExtractFuture,
4469 T7: ExtractFuture,
4470{
4471 pub fn new(t0: T0, t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7) -> Self {
4472 Self {
4473 pending: (false, false, false, false, false, false, false, false, ),
4474 futures: (t0, t1, t2, t3, t4, t5, t6, t7, ),
4475 }
4476 }
4477
4478 pub fn into_inner(self) -> (T0, T1, T2, T3, T4, T5, T6, T7,)
4479 {
4480 self.futures
4481 }
4482}
4483
4484impl<T0, T1, T2, T3, T4, T5, T6, T7> Future for Join8<T0, T1, T2, T3, T4, T5, T6, T7>
4485where
4486 T0: ExtractFuture,
4487 T1: ExtractFuture,
4488 T2: ExtractFuture,
4489 T3: ExtractFuture,
4490 T4: ExtractFuture,
4491 T5: ExtractFuture,
4492 T6: ExtractFuture,
4493 T7: ExtractFuture,
4494{
4495 type Item = ();
4496 type Error = extract::Error;
4497
4498 fn poll(&mut self) -> Poll<(), extract::Error> {
4499 let mut all_ready = true;
4500
4501 if !self.pending.0 {
4502 self.pending.0 = self.futures.0.poll()?.is_ready();
4503 all_ready &= self.pending.0;
4504 }
4505 if !self.pending.1 {
4506 self.pending.1 = self.futures.1.poll()?.is_ready();
4507 all_ready &= self.pending.1;
4508 }
4509 if !self.pending.2 {
4510 self.pending.2 = self.futures.2.poll()?.is_ready();
4511 all_ready &= self.pending.2;
4512 }
4513 if !self.pending.3 {
4514 self.pending.3 = self.futures.3.poll()?.is_ready();
4515 all_ready &= self.pending.3;
4516 }
4517 if !self.pending.4 {
4518 self.pending.4 = self.futures.4.poll()?.is_ready();
4519 all_ready &= self.pending.4;
4520 }
4521 if !self.pending.5 {
4522 self.pending.5 = self.futures.5.poll()?.is_ready();
4523 all_ready &= self.pending.5;
4524 }
4525 if !self.pending.6 {
4526 self.pending.6 = self.futures.6.poll()?.is_ready();
4527 all_ready &= self.pending.6;
4528 }
4529 if !self.pending.7 {
4530 self.pending.7 = self.futures.7.poll()?.is_ready();
4531 all_ready &= self.pending.7;
4532 }
4533 Ok(if all_ready { Async::Ready(()) } else { Async::NotReady })
4534 }
4535}
4536impl<S: Serializer, B: BufStream, T0, T1, T2, T3, T4, T5, T6, T7> IntoResource<S, B> for (T0, T1, T2, T3, T4, T5, T6, T7,)
4537where
4538 T0: IntoResource<S, B>,
4539 T1: IntoResource<S, B>,
4540 T2: IntoResource<S, B>,
4541 T3: IntoResource<S, B>,
4542 T4: IntoResource<S, B>,
4543 T5: IntoResource<S, B>,
4544 T6: IntoResource<S, B>,
4545 T7: IntoResource<S, B>,
4546{
4547 type Destination = Either8<T0::Destination, T1::Destination, T2::Destination, T3::Destination, T4::Destination, T5::Destination, T6::Destination, T7::Destination>;
4548 type Resource = (T0::Resource, T1::Resource, T2::Resource, T3::Resource, T4::Resource, T5::Resource, T6::Resource, T7::Resource,);
4549
4550 fn routes(&self) -> RouteSet<Self::Destination>
4551 {
4552 let mut routes = routing::Builder::new();
4553
4554 routes.insert_all(self.0.routes().map(Either8::A));
4555 routes.insert_all(self.1.routes().map(Either8::B));
4556 routes.insert_all(self.2.routes().map(Either8::C));
4557 routes.insert_all(self.3.routes().map(Either8::D));
4558 routes.insert_all(self.4.routes().map(Either8::E));
4559 routes.insert_all(self.5.routes().map(Either8::F));
4560 routes.insert_all(self.6.routes().map(Either8::G));
4561 routes.insert_all(self.7.routes().map(Either8::H));
4562 routes.build()
4563 }
4564
4565 fn into_resource(self, serializer: S) -> Self::Resource {
4566 (
4567 self.0.into_resource(serializer.clone()),
4568 self.1.into_resource(serializer.clone()),
4569 self.2.into_resource(serializer.clone()),
4570 self.3.into_resource(serializer.clone()),
4571 self.4.into_resource(serializer.clone()),
4572 self.5.into_resource(serializer.clone()),
4573 self.6.into_resource(serializer.clone()),
4574 self.7.into_resource(serializer.clone()),
4575 )
4576 }
4577}
4578impl<R0, R1, R2, R3, R4, R5, R6, R7, R8, U> Chain<U> for (R0, R1, R2, R3, R4, R5, R6, R7, R8,) {
4579 type Output = (R0, R1, R2, R3, R4, R5, R6, R7, R8, U);
4580
4581 fn chain(self, other: U) -> Self::Output {
4582 (self.0, self.1, self.2, self.3, self.4, self.5, self.6, self.7, self.8, other)
4583 }
4584}
4585
4586#[derive(Debug)]
4587pub struct Join9<T0, T1, T2, T3, T4, T5, T6, T7, T8> {
4588 futures: (T0, T1, T2, T3, T4, T5, T6, T7, T8,),
4589 pending: (bool, bool, bool, bool, bool, bool, bool, bool, bool,),
4590}
4591
4592impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> Join9<T0, T1, T2, T3, T4, T5, T6, T7, T8>
4593where
4594 T0: ExtractFuture,
4595 T1: ExtractFuture,
4596 T2: ExtractFuture,
4597 T3: ExtractFuture,
4598 T4: ExtractFuture,
4599 T5: ExtractFuture,
4600 T6: ExtractFuture,
4601 T7: ExtractFuture,
4602 T8: ExtractFuture,
4603{
4604 pub fn new(t0: T0, t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8) -> Self {
4605 Self {
4606 pending: (false, false, false, false, false, false, false, false, false, ),
4607 futures: (t0, t1, t2, t3, t4, t5, t6, t7, t8, ),
4608 }
4609 }
4610
4611 pub fn into_inner(self) -> (T0, T1, T2, T3, T4, T5, T6, T7, T8,)
4612 {
4613 self.futures
4614 }
4615}
4616
4617impl<T0, T1, T2, T3, T4, T5, T6, T7, T8> Future for Join9<T0, T1, T2, T3, T4, T5, T6, T7, T8>
4618where
4619 T0: ExtractFuture,
4620 T1: ExtractFuture,
4621 T2: ExtractFuture,
4622 T3: ExtractFuture,
4623 T4: ExtractFuture,
4624 T5: ExtractFuture,
4625 T6: ExtractFuture,
4626 T7: ExtractFuture,
4627 T8: ExtractFuture,
4628{
4629 type Item = ();
4630 type Error = extract::Error;
4631
4632 fn poll(&mut self) -> Poll<(), extract::Error> {
4633 let mut all_ready = true;
4634
4635 if !self.pending.0 {
4636 self.pending.0 = self.futures.0.poll()?.is_ready();
4637 all_ready &= self.pending.0;
4638 }
4639 if !self.pending.1 {
4640 self.pending.1 = self.futures.1.poll()?.is_ready();
4641 all_ready &= self.pending.1;
4642 }
4643 if !self.pending.2 {
4644 self.pending.2 = self.futures.2.poll()?.is_ready();
4645 all_ready &= self.pending.2;
4646 }
4647 if !self.pending.3 {
4648 self.pending.3 = self.futures.3.poll()?.is_ready();
4649 all_ready &= self.pending.3;
4650 }
4651 if !self.pending.4 {
4652 self.pending.4 = self.futures.4.poll()?.is_ready();
4653 all_ready &= self.pending.4;
4654 }
4655 if !self.pending.5 {
4656 self.pending.5 = self.futures.5.poll()?.is_ready();
4657 all_ready &= self.pending.5;
4658 }
4659 if !self.pending.6 {
4660 self.pending.6 = self.futures.6.poll()?.is_ready();
4661 all_ready &= self.pending.6;
4662 }
4663 if !self.pending.7 {
4664 self.pending.7 = self.futures.7.poll()?.is_ready();
4665 all_ready &= self.pending.7;
4666 }
4667 if !self.pending.8 {
4668 self.pending.8 = self.futures.8.poll()?.is_ready();
4669 all_ready &= self.pending.8;
4670 }
4671 Ok(if all_ready { Async::Ready(()) } else { Async::NotReady })
4672 }
4673}
4674impl<S: Serializer, B: BufStream, T0, T1, T2, T3, T4, T5, T6, T7, T8> IntoResource<S, B> for (T0, T1, T2, T3, T4, T5, T6, T7, T8,)
4675where
4676 T0: IntoResource<S, B>,
4677 T1: IntoResource<S, B>,
4678 T2: IntoResource<S, B>,
4679 T3: IntoResource<S, B>,
4680 T4: IntoResource<S, B>,
4681 T5: IntoResource<S, B>,
4682 T6: IntoResource<S, B>,
4683 T7: IntoResource<S, B>,
4684 T8: IntoResource<S, B>,
4685{
4686 type Destination = Either9<T0::Destination, T1::Destination, T2::Destination, T3::Destination, T4::Destination, T5::Destination, T6::Destination, T7::Destination, T8::Destination>;
4687 type Resource = (T0::Resource, T1::Resource, T2::Resource, T3::Resource, T4::Resource, T5::Resource, T6::Resource, T7::Resource, T8::Resource,);
4688
4689 fn routes(&self) -> RouteSet<Self::Destination>
4690 {
4691 let mut routes = routing::Builder::new();
4692
4693 routes.insert_all(self.0.routes().map(Either9::A));
4694 routes.insert_all(self.1.routes().map(Either9::B));
4695 routes.insert_all(self.2.routes().map(Either9::C));
4696 routes.insert_all(self.3.routes().map(Either9::D));
4697 routes.insert_all(self.4.routes().map(Either9::E));
4698 routes.insert_all(self.5.routes().map(Either9::F));
4699 routes.insert_all(self.6.routes().map(Either9::G));
4700 routes.insert_all(self.7.routes().map(Either9::H));
4701 routes.insert_all(self.8.routes().map(Either9::I));
4702 routes.build()
4703 }
4704
4705 fn into_resource(self, serializer: S) -> Self::Resource {
4706 (
4707 self.0.into_resource(serializer.clone()),
4708 self.1.into_resource(serializer.clone()),
4709 self.2.into_resource(serializer.clone()),
4710 self.3.into_resource(serializer.clone()),
4711 self.4.into_resource(serializer.clone()),
4712 self.5.into_resource(serializer.clone()),
4713 self.6.into_resource(serializer.clone()),
4714 self.7.into_resource(serializer.clone()),
4715 self.8.into_resource(serializer.clone()),
4716 )
4717 }
4718}
4719impl<R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, U> Chain<U> for (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9,) {
4720 type Output = (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, U);
4721
4722 fn chain(self, other: U) -> Self::Output {
4723 (self.0, self.1, self.2, self.3, self.4, self.5, self.6, self.7, self.8, self.9, other)
4724 }
4725}
4726
4727#[derive(Debug)]
4728pub struct Join10<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> {
4729 futures: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9,),
4730 pending: (bool, bool, bool, bool, bool, bool, bool, bool, bool, bool,),
4731}
4732
4733impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> Join10<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>
4734where
4735 T0: ExtractFuture,
4736 T1: ExtractFuture,
4737 T2: ExtractFuture,
4738 T3: ExtractFuture,
4739 T4: ExtractFuture,
4740 T5: ExtractFuture,
4741 T6: ExtractFuture,
4742 T7: ExtractFuture,
4743 T8: ExtractFuture,
4744 T9: ExtractFuture,
4745{
4746 pub fn new(t0: T0, t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9) -> Self {
4747 Self {
4748 pending: (false, false, false, false, false, false, false, false, false, false, ),
4749 futures: (t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, ),
4750 }
4751 }
4752
4753 pub fn into_inner(self) -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9,)
4754 {
4755 self.futures
4756 }
4757}
4758
4759impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> Future for Join10<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>
4760where
4761 T0: ExtractFuture,
4762 T1: ExtractFuture,
4763 T2: ExtractFuture,
4764 T3: ExtractFuture,
4765 T4: ExtractFuture,
4766 T5: ExtractFuture,
4767 T6: ExtractFuture,
4768 T7: ExtractFuture,
4769 T8: ExtractFuture,
4770 T9: ExtractFuture,
4771{
4772 type Item = ();
4773 type Error = extract::Error;
4774
4775 fn poll(&mut self) -> Poll<(), extract::Error> {
4776 let mut all_ready = true;
4777
4778 if !self.pending.0 {
4779 self.pending.0 = self.futures.0.poll()?.is_ready();
4780 all_ready &= self.pending.0;
4781 }
4782 if !self.pending.1 {
4783 self.pending.1 = self.futures.1.poll()?.is_ready();
4784 all_ready &= self.pending.1;
4785 }
4786 if !self.pending.2 {
4787 self.pending.2 = self.futures.2.poll()?.is_ready();
4788 all_ready &= self.pending.2;
4789 }
4790 if !self.pending.3 {
4791 self.pending.3 = self.futures.3.poll()?.is_ready();
4792 all_ready &= self.pending.3;
4793 }
4794 if !self.pending.4 {
4795 self.pending.4 = self.futures.4.poll()?.is_ready();
4796 all_ready &= self.pending.4;
4797 }
4798 if !self.pending.5 {
4799 self.pending.5 = self.futures.5.poll()?.is_ready();
4800 all_ready &= self.pending.5;
4801 }
4802 if !self.pending.6 {
4803 self.pending.6 = self.futures.6.poll()?.is_ready();
4804 all_ready &= self.pending.6;
4805 }
4806 if !self.pending.7 {
4807 self.pending.7 = self.futures.7.poll()?.is_ready();
4808 all_ready &= self.pending.7;
4809 }
4810 if !self.pending.8 {
4811 self.pending.8 = self.futures.8.poll()?.is_ready();
4812 all_ready &= self.pending.8;
4813 }
4814 if !self.pending.9 {
4815 self.pending.9 = self.futures.9.poll()?.is_ready();
4816 all_ready &= self.pending.9;
4817 }
4818 Ok(if all_ready { Async::Ready(()) } else { Async::NotReady })
4819 }
4820}
4821impl<S: Serializer, B: BufStream, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9> IntoResource<S, B> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9,)
4822where
4823 T0: IntoResource<S, B>,
4824 T1: IntoResource<S, B>,
4825 T2: IntoResource<S, B>,
4826 T3: IntoResource<S, B>,
4827 T4: IntoResource<S, B>,
4828 T5: IntoResource<S, B>,
4829 T6: IntoResource<S, B>,
4830 T7: IntoResource<S, B>,
4831 T8: IntoResource<S, B>,
4832 T9: IntoResource<S, B>,
4833{
4834 type Destination = Either10<T0::Destination, T1::Destination, T2::Destination, T3::Destination, T4::Destination, T5::Destination, T6::Destination, T7::Destination, T8::Destination, T9::Destination>;
4835 type Resource = (T0::Resource, T1::Resource, T2::Resource, T3::Resource, T4::Resource, T5::Resource, T6::Resource, T7::Resource, T8::Resource, T9::Resource,);
4836
4837 fn routes(&self) -> RouteSet<Self::Destination>
4838 {
4839 let mut routes = routing::Builder::new();
4840
4841 routes.insert_all(self.0.routes().map(Either10::A));
4842 routes.insert_all(self.1.routes().map(Either10::B));
4843 routes.insert_all(self.2.routes().map(Either10::C));
4844 routes.insert_all(self.3.routes().map(Either10::D));
4845 routes.insert_all(self.4.routes().map(Either10::E));
4846 routes.insert_all(self.5.routes().map(Either10::F));
4847 routes.insert_all(self.6.routes().map(Either10::G));
4848 routes.insert_all(self.7.routes().map(Either10::H));
4849 routes.insert_all(self.8.routes().map(Either10::I));
4850 routes.insert_all(self.9.routes().map(Either10::J));
4851 routes.build()
4852 }
4853
4854 fn into_resource(self, serializer: S) -> Self::Resource {
4855 (
4856 self.0.into_resource(serializer.clone()),
4857 self.1.into_resource(serializer.clone()),
4858 self.2.into_resource(serializer.clone()),
4859 self.3.into_resource(serializer.clone()),
4860 self.4.into_resource(serializer.clone()),
4861 self.5.into_resource(serializer.clone()),
4862 self.6.into_resource(serializer.clone()),
4863 self.7.into_resource(serializer.clone()),
4864 self.8.into_resource(serializer.clone()),
4865 self.9.into_resource(serializer.clone()),
4866 )
4867 }
4868}
4869impl<R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, U> Chain<U> for (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10,) {
4870 type Output = (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, U);
4871
4872 fn chain(self, other: U) -> Self::Output {
4873 (self.0, self.1, self.2, self.3, self.4, self.5, self.6, self.7, self.8, self.9, self.10, other)
4874 }
4875}
4876
4877#[derive(Debug)]
4878pub struct Join11<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> {
4879 futures: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,),
4880 pending: (bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool,),
4881}
4882
4883impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Join11<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
4884where
4885 T0: ExtractFuture,
4886 T1: ExtractFuture,
4887 T2: ExtractFuture,
4888 T3: ExtractFuture,
4889 T4: ExtractFuture,
4890 T5: ExtractFuture,
4891 T6: ExtractFuture,
4892 T7: ExtractFuture,
4893 T8: ExtractFuture,
4894 T9: ExtractFuture,
4895 T10: ExtractFuture,
4896{
4897 pub fn new(t0: T0, t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9, t10: T10) -> Self {
4898 Self {
4899 pending: (false, false, false, false, false, false, false, false, false, false, false, ),
4900 futures: (t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, ),
4901 }
4902 }
4903
4904 pub fn into_inner(self) -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,)
4905 {
4906 self.futures
4907 }
4908}
4909
4910impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> Future for Join11<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>
4911where
4912 T0: ExtractFuture,
4913 T1: ExtractFuture,
4914 T2: ExtractFuture,
4915 T3: ExtractFuture,
4916 T4: ExtractFuture,
4917 T5: ExtractFuture,
4918 T6: ExtractFuture,
4919 T7: ExtractFuture,
4920 T8: ExtractFuture,
4921 T9: ExtractFuture,
4922 T10: ExtractFuture,
4923{
4924 type Item = ();
4925 type Error = extract::Error;
4926
4927 fn poll(&mut self) -> Poll<(), extract::Error> {
4928 let mut all_ready = true;
4929
4930 if !self.pending.0 {
4931 self.pending.0 = self.futures.0.poll()?.is_ready();
4932 all_ready &= self.pending.0;
4933 }
4934 if !self.pending.1 {
4935 self.pending.1 = self.futures.1.poll()?.is_ready();
4936 all_ready &= self.pending.1;
4937 }
4938 if !self.pending.2 {
4939 self.pending.2 = self.futures.2.poll()?.is_ready();
4940 all_ready &= self.pending.2;
4941 }
4942 if !self.pending.3 {
4943 self.pending.3 = self.futures.3.poll()?.is_ready();
4944 all_ready &= self.pending.3;
4945 }
4946 if !self.pending.4 {
4947 self.pending.4 = self.futures.4.poll()?.is_ready();
4948 all_ready &= self.pending.4;
4949 }
4950 if !self.pending.5 {
4951 self.pending.5 = self.futures.5.poll()?.is_ready();
4952 all_ready &= self.pending.5;
4953 }
4954 if !self.pending.6 {
4955 self.pending.6 = self.futures.6.poll()?.is_ready();
4956 all_ready &= self.pending.6;
4957 }
4958 if !self.pending.7 {
4959 self.pending.7 = self.futures.7.poll()?.is_ready();
4960 all_ready &= self.pending.7;
4961 }
4962 if !self.pending.8 {
4963 self.pending.8 = self.futures.8.poll()?.is_ready();
4964 all_ready &= self.pending.8;
4965 }
4966 if !self.pending.9 {
4967 self.pending.9 = self.futures.9.poll()?.is_ready();
4968 all_ready &= self.pending.9;
4969 }
4970 if !self.pending.10 {
4971 self.pending.10 = self.futures.10.poll()?.is_ready();
4972 all_ready &= self.pending.10;
4973 }
4974 Ok(if all_ready { Async::Ready(()) } else { Async::NotReady })
4975 }
4976}
4977impl<S: Serializer, B: BufStream, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10> IntoResource<S, B> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10,)
4978where
4979 T0: IntoResource<S, B>,
4980 T1: IntoResource<S, B>,
4981 T2: IntoResource<S, B>,
4982 T3: IntoResource<S, B>,
4983 T4: IntoResource<S, B>,
4984 T5: IntoResource<S, B>,
4985 T6: IntoResource<S, B>,
4986 T7: IntoResource<S, B>,
4987 T8: IntoResource<S, B>,
4988 T9: IntoResource<S, B>,
4989 T10: IntoResource<S, B>,
4990{
4991 type Destination = Either11<T0::Destination, T1::Destination, T2::Destination, T3::Destination, T4::Destination, T5::Destination, T6::Destination, T7::Destination, T8::Destination, T9::Destination, T10::Destination>;
4992 type Resource = (T0::Resource, T1::Resource, T2::Resource, T3::Resource, T4::Resource, T5::Resource, T6::Resource, T7::Resource, T8::Resource, T9::Resource, T10::Resource,);
4993
4994 fn routes(&self) -> RouteSet<Self::Destination>
4995 {
4996 let mut routes = routing::Builder::new();
4997
4998 routes.insert_all(self.0.routes().map(Either11::A));
4999 routes.insert_all(self.1.routes().map(Either11::B));
5000 routes.insert_all(self.2.routes().map(Either11::C));
5001 routes.insert_all(self.3.routes().map(Either11::D));
5002 routes.insert_all(self.4.routes().map(Either11::E));
5003 routes.insert_all(self.5.routes().map(Either11::F));
5004 routes.insert_all(self.6.routes().map(Either11::G));
5005 routes.insert_all(self.7.routes().map(Either11::H));
5006 routes.insert_all(self.8.routes().map(Either11::I));
5007 routes.insert_all(self.9.routes().map(Either11::J));
5008 routes.insert_all(self.10.routes().map(Either11::K));
5009 routes.build()
5010 }
5011
5012 fn into_resource(self, serializer: S) -> Self::Resource {
5013 (
5014 self.0.into_resource(serializer.clone()),
5015 self.1.into_resource(serializer.clone()),
5016 self.2.into_resource(serializer.clone()),
5017 self.3.into_resource(serializer.clone()),
5018 self.4.into_resource(serializer.clone()),
5019 self.5.into_resource(serializer.clone()),
5020 self.6.into_resource(serializer.clone()),
5021 self.7.into_resource(serializer.clone()),
5022 self.8.into_resource(serializer.clone()),
5023 self.9.into_resource(serializer.clone()),
5024 self.10.into_resource(serializer.clone()),
5025 )
5026 }
5027}
5028impl<R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, U> Chain<U> for (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11,) {
5029 type Output = (R0, R1, R2, R3, R4, R5, R6, R7, R8, R9, R10, R11, U);
5030
5031 fn chain(self, other: U) -> Self::Output {
5032 (self.0, self.1, self.2, self.3, self.4, self.5, self.6, self.7, self.8, self.9, self.10, self.11, other)
5033 }
5034}
5035
5036#[derive(Debug)]
5037pub struct Join12<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> {
5038 futures: (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,),
5039 pending: (bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool, bool,),
5040}
5041
5042impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Join12<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>
5043where
5044 T0: ExtractFuture,
5045 T1: ExtractFuture,
5046 T2: ExtractFuture,
5047 T3: ExtractFuture,
5048 T4: ExtractFuture,
5049 T5: ExtractFuture,
5050 T6: ExtractFuture,
5051 T7: ExtractFuture,
5052 T8: ExtractFuture,
5053 T9: ExtractFuture,
5054 T10: ExtractFuture,
5055 T11: ExtractFuture,
5056{
5057 pub fn new(t0: T0, t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6, t7: T7, t8: T8, t9: T9, t10: T10, t11: T11) -> Self {
5058 Self {
5059 pending: (false, false, false, false, false, false, false, false, false, false, false, false, ),
5060 futures: (t0, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, ),
5061 }
5062 }
5063
5064 pub fn into_inner(self) -> (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,)
5065 {
5066 self.futures
5067 }
5068}
5069
5070impl<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> Future for Join12<T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11>
5071where
5072 T0: ExtractFuture,
5073 T1: ExtractFuture,
5074 T2: ExtractFuture,
5075 T3: ExtractFuture,
5076 T4: ExtractFuture,
5077 T5: ExtractFuture,
5078 T6: ExtractFuture,
5079 T7: ExtractFuture,
5080 T8: ExtractFuture,
5081 T9: ExtractFuture,
5082 T10: ExtractFuture,
5083 T11: ExtractFuture,
5084{
5085 type Item = ();
5086 type Error = extract::Error;
5087
5088 fn poll(&mut self) -> Poll<(), extract::Error> {
5089 let mut all_ready = true;
5090
5091 if !self.pending.0 {
5092 self.pending.0 = self.futures.0.poll()?.is_ready();
5093 all_ready &= self.pending.0;
5094 }
5095 if !self.pending.1 {
5096 self.pending.1 = self.futures.1.poll()?.is_ready();
5097 all_ready &= self.pending.1;
5098 }
5099 if !self.pending.2 {
5100 self.pending.2 = self.futures.2.poll()?.is_ready();
5101 all_ready &= self.pending.2;
5102 }
5103 if !self.pending.3 {
5104 self.pending.3 = self.futures.3.poll()?.is_ready();
5105 all_ready &= self.pending.3;
5106 }
5107 if !self.pending.4 {
5108 self.pending.4 = self.futures.4.poll()?.is_ready();
5109 all_ready &= self.pending.4;
5110 }
5111 if !self.pending.5 {
5112 self.pending.5 = self.futures.5.poll()?.is_ready();
5113 all_ready &= self.pending.5;
5114 }
5115 if !self.pending.6 {
5116 self.pending.6 = self.futures.6.poll()?.is_ready();
5117 all_ready &= self.pending.6;
5118 }
5119 if !self.pending.7 {
5120 self.pending.7 = self.futures.7.poll()?.is_ready();
5121 all_ready &= self.pending.7;
5122 }
5123 if !self.pending.8 {
5124 self.pending.8 = self.futures.8.poll()?.is_ready();
5125 all_ready &= self.pending.8;
5126 }
5127 if !self.pending.9 {
5128 self.pending.9 = self.futures.9.poll()?.is_ready();
5129 all_ready &= self.pending.9;
5130 }
5131 if !self.pending.10 {
5132 self.pending.10 = self.futures.10.poll()?.is_ready();
5133 all_ready &= self.pending.10;
5134 }
5135 if !self.pending.11 {
5136 self.pending.11 = self.futures.11.poll()?.is_ready();
5137 all_ready &= self.pending.11;
5138 }
5139 Ok(if all_ready { Async::Ready(()) } else { Async::NotReady })
5140 }
5141}
5142impl<S: Serializer, B: BufStream, T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11> IntoResource<S, B> for (T0, T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11,)
5143where
5144 T0: IntoResource<S, B>,
5145 T1: IntoResource<S, B>,
5146 T2: IntoResource<S, B>,
5147 T3: IntoResource<S, B>,
5148 T4: IntoResource<S, B>,
5149 T5: IntoResource<S, B>,
5150 T6: IntoResource<S, B>,
5151 T7: IntoResource<S, B>,
5152 T8: IntoResource<S, B>,
5153 T9: IntoResource<S, B>,
5154 T10: IntoResource<S, B>,
5155 T11: IntoResource<S, B>,
5156{
5157 type Destination = Either12<T0::Destination, T1::Destination, T2::Destination, T3::Destination, T4::Destination, T5::Destination, T6::Destination, T7::Destination, T8::Destination, T9::Destination, T10::Destination, T11::Destination>;
5158 type Resource = (T0::Resource, T1::Resource, T2::Resource, T3::Resource, T4::Resource, T5::Resource, T6::Resource, T7::Resource, T8::Resource, T9::Resource, T10::Resource, T11::Resource,);
5159
5160 fn routes(&self) -> RouteSet<Self::Destination>
5161 {
5162 let mut routes = routing::Builder::new();
5163
5164 routes.insert_all(self.0.routes().map(Either12::A));
5165 routes.insert_all(self.1.routes().map(Either12::B));
5166 routes.insert_all(self.2.routes().map(Either12::C));
5167 routes.insert_all(self.3.routes().map(Either12::D));
5168 routes.insert_all(self.4.routes().map(Either12::E));
5169 routes.insert_all(self.5.routes().map(Either12::F));
5170 routes.insert_all(self.6.routes().map(Either12::G));
5171 routes.insert_all(self.7.routes().map(Either12::H));
5172 routes.insert_all(self.8.routes().map(Either12::I));
5173 routes.insert_all(self.9.routes().map(Either12::J));
5174 routes.insert_all(self.10.routes().map(Either12::K));
5175 routes.insert_all(self.11.routes().map(Either12::L));
5176 routes.build()
5177 }
5178
5179 fn into_resource(self, serializer: S) -> Self::Resource {
5180 (
5181 self.0.into_resource(serializer.clone()),
5182 self.1.into_resource(serializer.clone()),
5183 self.2.into_resource(serializer.clone()),
5184 self.3.into_resource(serializer.clone()),
5185 self.4.into_resource(serializer.clone()),
5186 self.5.into_resource(serializer.clone()),
5187 self.6.into_resource(serializer.clone()),
5188 self.7.into_resource(serializer.clone()),
5189 self.8.into_resource(serializer.clone()),
5190 self.9.into_resource(serializer.clone()),
5191 self.10.into_resource(serializer.clone()),
5192 self.11.into_resource(serializer.clone()),
5193 )
5194 }
5195}