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

remove either crate conversions

This commit is contained in:
Rob Ede 2021-12-14 18:30:12 +00:00
parent fb091b2b88
commit 2ee953a118
No known key found for this signature in database
GPG Key ID: 97C636207D3EF933
3 changed files with 6 additions and 22 deletions

View File

@ -10,8 +10,10 @@
### Removed
* Top-level `EitherExtractError` export. [#2510]
* Conversion implementations for `either` crate. [#2516]
[#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

View File

@ -86,7 +86,6 @@ bytes = "1"
cfg-if = "1"
cookie = { version = "0.15", features = ["percent-encode"], optional = true }
derive_more = "0.99.5"
either = "1.5.3"
encoding_rs = "0.8"
futures-core = { 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 crate::{
body, dev,
body::EitherBody,
dev,
web::{Form, Json},
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)]
impl<L, R> Either<L, R> {
pub(self) fn unwrap_left(self) -> L {
@ -146,7 +129,7 @@ where
L: 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> {
match self {
@ -165,7 +148,7 @@ pub enum EitherExtractError<L, R> {
/// Error from payload buffering, such as exceeding payload max size limit.
Bytes(Error),
/// Error from primary extractor.
/// Error from primary and fallback extractors.
Extract(L, R),
}