1
0
mirror of https://github.com/fafhrd91/actix-web synced 2024-11-24 00:21:08 +01:00

remove either crate conversions (#2516)

This commit is contained in:
Rob Ede 2021-12-14 19:57:18 +00:00 committed by GitHub
parent fb091b2b88
commit 05255c7f7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 22 deletions

View File

@ -10,8 +10,10 @@
### Removed ### Removed
* Top-level `EitherExtractError` export. [#2510] * Top-level `EitherExtractError` export. [#2510]
* Conversion implementations for `either` crate. [#2516]
[#2510]: https://github.com/actix/actix-web/pull/2510 [#2510]: https://github.com/actix/actix-web/pull/2510
[#2516]: https://github.com/actix/actix-web/pull/2516
## 4.0.0-beta.14 - 2021-12-11 ## 4.0.0-beta.14 - 2021-12-11

View File

@ -86,7 +86,6 @@ bytes = "1"
cfg-if = "1" cfg-if = "1"
cookie = { version = "0.15", features = ["percent-encode"], optional = true } cookie = { version = "0.15", features = ["percent-encode"], optional = true }
derive_more = "0.99.5" derive_more = "0.99.5"
either = "1.5.3"
encoding_rs = "0.8" encoding_rs = "0.8"
futures-core = { version = "0.3.7", default-features = false } futures-core = { version = "0.3.7", default-features = false }
futures-util = { version = "0.3.7", default-features = false } futures-util = { version = "0.3.7", default-features = false }

View File

@ -12,7 +12,8 @@ use futures_core::ready;
use pin_project_lite::pin_project; use pin_project_lite::pin_project;
use crate::{ use crate::{
body, dev, body::EitherBody,
dev,
web::{Form, Json}, web::{Form, Json},
Error, FromRequest, HttpRequest, HttpResponse, Responder, Error, FromRequest, HttpRequest, HttpResponse, Responder,
}; };
@ -101,24 +102,6 @@ impl<T> Either<Json<T>, Form<T>> {
} }
} }
impl<L, R> From<either::Either<L, R>> for Either<L, R> {
fn from(val: either::Either<L, R>) -> Self {
match val {
either::Either::Left(l) => Either::Left(l),
either::Either::Right(r) => Either::Right(r),
}
}
}
impl<L, R> From<Either<L, R>> for either::Either<L, R> {
fn from(val: Either<L, R>) -> Self {
match val {
Either::Left(l) => either::Either::Left(l),
Either::Right(r) => either::Either::Right(r),
}
}
}
#[cfg(test)] #[cfg(test)]
impl<L, R> Either<L, R> { impl<L, R> Either<L, R> {
pub(self) fn unwrap_left(self) -> L { pub(self) fn unwrap_left(self) -> L {
@ -146,7 +129,7 @@ where
L: Responder, L: Responder,
R: Responder, R: Responder,
{ {
type Body = body::EitherBody<L::Body, R::Body>; type Body = EitherBody<L::Body, R::Body>;
fn respond_to(self, req: &HttpRequest) -> HttpResponse<Self::Body> { fn respond_to(self, req: &HttpRequest) -> HttpResponse<Self::Body> {
match self { match self {
@ -165,7 +148,7 @@ pub enum EitherExtractError<L, R> {
/// Error from payload buffering, such as exceeding payload max size limit. /// Error from payload buffering, such as exceeding payload max size limit.
Bytes(Error), Bytes(Error),
/// Error from primary extractor. /// Error from primary and fallback extractors.
Extract(L, R), Extract(L, R),
} }