Add Either{2..8} to axum-extra (#1263)

* Add `Either{2..8}`

* Apply suggestions from code review

Co-authored-by: Jonas Platte <[email protected]>

* Either2 => Either

* Update axum-extra/src/either.rs

Co-authored-by: Jonas Platte <[email protected]>

Co-authored-by: Jonas Platte <[email protected]>
This commit is contained in:
David Pedersen
2022-08-17 08:57:19 +00:00
committed by GitHub
co-authored by Jonas Platte
parent fb21561616
commit e22f6f9d2b
4 changed files with 240 additions and 49 deletions
+3 -3
View File
@@ -1,5 +1,5 @@
use super::HandlerCallWithExtractors;
use crate::Either;
use crate::either::Either;
use axum::{
extract::{FromRequest, RequestParts},
handler::Handler,
@@ -40,12 +40,12 @@ where
extractors: Either<Lt, Rt>,
) -> <Self as HandlerCallWithExtractors<Either<Lt, Rt>, B>>::Future {
match extractors {
Either::Left(lt) => self
Either::E1(lt) => self
.lhs
.call(lt)
.map(IntoResponse::into_response as _)
.left_future(),
Either::Right(rt) => self
Either::E2(rt) => self
.rhs
.call(rt)
.map(IntoResponse::into_response as _)