1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-27 17:22:57 +01:00

cleanup deprecation warning for Box<dyn>

This commit is contained in:
Nikolay Kim 2019-07-17 11:44:39 +06:00
parent c65dbaf88e
commit 7b1dcaffda
20 changed files with 59 additions and 54 deletions

View File

@ -681,7 +681,7 @@ where
type Error = Error; type Error = Error;
type Future = Either< type Future = Either<
FutureResult<Self::Response, Error>, FutureResult<Self::Response, Error>,
Either<S::Future, Box<Future<Item = Self::Response, Error = Error>>>, Either<S::Future, Box<dyn Future<Item = Self::Response, Error = Error>>>,
>; >;
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {

View File

@ -50,7 +50,7 @@ pub struct ChunkedReadFile {
size: u64, size: u64,
offset: u64, offset: u64,
file: Option<File>, file: Option<File>,
fut: Option<Box<Future<Item = (File, Bytes), Error = BlockingError<io::Error>>>>, fut: Option<Box<dyn Future<Item = (File, Bytes), Error = BlockingError<io::Error>>>>,
counter: u64, counter: u64,
} }
@ -370,7 +370,7 @@ impl NewService for Files {
type Error = Error; type Error = Error;
type Service = FilesService; type Service = FilesService;
type InitError = (); type InitError = ();
type Future = Box<Future<Item = Self::Service, Error = Self::InitError>>; type Future = Box<dyn Future<Item = Self::Service, Error = Self::InitError>>;
fn new_service(&self, _: &()) -> Self::Future { fn new_service(&self, _: &()) -> Self::Future {
let mut srv = FilesService { let mut srv = FilesService {
@ -416,7 +416,7 @@ impl FilesService {
req: ServiceRequest, req: ServiceRequest,
) -> Either< ) -> Either<
FutureResult<ServiceResponse, Error>, FutureResult<ServiceResponse, Error>,
Box<Future<Item = ServiceResponse, Error = Error>>, Box<dyn Future<Item = ServiceResponse, Error = Error>>,
> { > {
log::debug!("Files: Failed to handle {}: {}", req.path(), e); log::debug!("Files: Failed to handle {}: {}", req.path(), e);
if let Some(ref mut default) = self.default { if let Some(ref mut default) = self.default {
@ -433,7 +433,7 @@ impl Service for FilesService {
type Error = Error; type Error = Error;
type Future = Either< type Future = Either<
FutureResult<Self::Response, Self::Error>, FutureResult<Self::Response, Self::Error>,
Box<Future<Item = Self::Response, Error = Self::Error>>, Box<dyn Future<Item = Self::Response, Error = Self::Error>>,
>; >;
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {

View File

@ -13,7 +13,7 @@ use crate::helpers::{BoxedHttpNewService, BoxedHttpService, HttpNewService};
use crate::request::FramedRequest; use crate::request::FramedRequest;
use crate::state::State; use crate::state::State;
type BoxedResponse = Box<Future<Item = (), Error = Error>>; type BoxedResponse = Box<dyn Future<Item = (), Error = Error>>;
pub trait HttpServiceFactory { pub trait HttpServiceFactory {
type Factory: NewService; type Factory: NewService;
@ -61,7 +61,7 @@ impl<T: 'static, S: 'static> FramedApp<T, S> {
Request = FramedRequest<T, S>, Request = FramedRequest<T, S>,
Response = (), Response = (),
Error = Error, Error = Error,
Future = Box<Future<Item = (), Error = Error>>, Future = Box<dyn Future<Item = (), Error = Error>>,
>, >,
{ {
let path = factory.path().to_string(); let path = factory.path().to_string();
@ -129,7 +129,7 @@ pub struct CreateService<T, S> {
enum CreateServiceItem<T, S> { enum CreateServiceItem<T, S> {
Future( Future(
Option<String>, Option<String>,
Box<Future<Item = BoxedHttpService<FramedRequest<T, S>>, Error = ()>>, Box<dyn Future<Item = BoxedHttpService<FramedRequest<T, S>>, Error = ()>>,
), ),
Service(String, BoxedHttpService<FramedRequest<T, S>>), Service(String, BoxedHttpService<FramedRequest<T, S>>),
} }

View File

@ -7,7 +7,7 @@ pub(crate) type BoxedHttpService<Req> = Box<
Request = Req, Request = Req,
Response = (), Response = (),
Error = Error, Error = Error,
Future = Box<Future<Item = (), Error = Error>>, Future = Box<dyn Future<Item = (), Error = Error>>,
>, >,
>; >;
@ -19,7 +19,7 @@ pub(crate) type BoxedHttpNewService<Req> = Box<
Error = Error, Error = Error,
InitError = (), InitError = (),
Service = BoxedHttpService<Req>, Service = BoxedHttpService<Req>,
Future = Box<Future<Item = BoxedHttpService<Req>, Error = ()>>, Future = Box<dyn Future<Item = BoxedHttpService<Req>, Error = ()>>,
>, >,
>; >;
@ -30,7 +30,7 @@ where
T: NewService<Response = (), Error = Error>, T: NewService<Response = (), Error = Error>,
T::Response: 'static, T::Response: 'static,
T::Future: 'static, T::Future: 'static,
T::Service: Service<Future = Box<Future<Item = (), Error = Error>>> + 'static, T::Service: Service<Future = Box<dyn Future<Item = (), Error = Error>>> + 'static,
<T::Service as Service>::Future: 'static, <T::Service as Service>::Future: 'static,
{ {
pub fn new(service: T) -> Self { pub fn new(service: T) -> Self {
@ -43,7 +43,7 @@ where
T: NewService<Config = (), Response = (), Error = Error>, T: NewService<Config = (), Response = (), Error = Error>,
T::Request: 'static, T::Request: 'static,
T::Future: 'static, T::Future: 'static,
T::Service: Service<Future = Box<Future<Item = (), Error = Error>>> + 'static, T::Service: Service<Future = Box<dyn Future<Item = (), Error = Error>>> + 'static,
<T::Service as Service>::Future: 'static, <T::Service as Service>::Future: 'static,
{ {
type Config = (); type Config = ();
@ -52,7 +52,7 @@ where
type Error = Error; type Error = Error;
type InitError = (); type InitError = ();
type Service = BoxedHttpService<T::Request>; type Service = BoxedHttpService<T::Request>;
type Future = Box<Future<Item = Self::Service, Error = ()>>; type Future = Box<dyn Future<Item = Self::Service, Error = ()>>;
fn new_service(&self, _: &()) -> Self::Future { fn new_service(&self, _: &()) -> Self::Future {
Box::new(self.0.new_service(&()).map_err(|_| ()).and_then(|service| { Box::new(self.0.new_service(&()).map_err(|_| ()).and_then(|service| {
@ -70,7 +70,7 @@ impl<T> Service for HttpServiceWrapper<T>
where where
T: Service< T: Service<
Response = (), Response = (),
Future = Box<Future<Item = (), Error = Error>>, Future = Box<dyn Future<Item = (), Error = Error>>,
Error = Error, Error = Error,
>, >,
T::Request: 'static, T::Request: 'static,
@ -78,7 +78,7 @@ where
type Request = T::Request; type Request = T::Request;
type Response = (); type Response = ();
type Error = Error; type Error = Error;
type Future = Box<Future<Item = (), Error = Error>>; type Future = Box<dyn Future<Item = (), Error = Error>>;
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {
self.service.poll_ready() self.service.poll_ready()

View File

@ -140,7 +140,7 @@ where
type Request = FramedRequest<Io, S>; type Request = FramedRequest<Io, S>;
type Response = (); type Response = ();
type Error = Error; type Error = Error;
type Future = Box<Future<Item = (), Error = Error>>; type Future = Box<dyn Future<Item = (), Error = Error>>;
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {
Ok(Async::Ready(())) Ok(Async::Ready(()))

View File

@ -94,7 +94,8 @@ where
T: AsyncRead + AsyncWrite + 'static, T: AsyncRead + AsyncWrite + 'static,
{ {
type Io = T; type Io = T;
type Future = Box<Future<Item = (ResponseHead, Payload), Error = SendRequestError>>; type Future =
Box<dyn Future<Item = (ResponseHead, Payload), Error = SendRequestError>>;
fn protocol(&self) -> Protocol { fn protocol(&self) -> Protocol {
match self.io { match self.io {
@ -169,7 +170,8 @@ where
B: AsyncRead + AsyncWrite + 'static, B: AsyncRead + AsyncWrite + 'static,
{ {
type Io = EitherIo<A, B>; type Io = EitherIo<A, B>;
type Future = Box<Future<Item = (ResponseHead, Payload), Error = SendRequestError>>; type Future =
Box<dyn Future<Item = (ResponseHead, Payload), Error = SendRequestError>>;
fn protocol(&self) -> Protocol { fn protocol(&self) -> Protocol {
match self { match self {

View File

@ -261,7 +261,7 @@ where
type Request = ServiceRequest; type Request = ServiceRequest;
type Response = ServiceResponse<B>; type Response = ServiceResponse<B>;
type Error = Error; type Error = Error;
type Future = Box<Future<Item = Self::Response, Error = Self::Error>>; type Future = Box<dyn Future<Item = Self::Response, Error = Self::Error>>;
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {
self.service.borrow_mut().poll_ready() self.service.borrow_mut().poll_ready()

View File

@ -309,7 +309,7 @@ where
type Request = ServiceRequest; type Request = ServiceRequest;
type Response = ServiceResponse<B>; type Response = ServiceResponse<B>;
type Error = S::Error; type Error = S::Error;
type Future = Box<Future<Item = Self::Response, Error = Self::Error>>; type Future = Box<dyn Future<Item = Self::Response, Error = Self::Error>>;
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {
self.service.poll_ready() self.service.poll_ready()

View File

@ -20,7 +20,7 @@ pub(crate) trait Connect {
head: RequestHead, head: RequestHead,
body: Body, body: Body,
addr: Option<net::SocketAddr>, addr: Option<net::SocketAddr>,
) -> Box<Future<Item = ClientResponse, Error = SendRequestError>>; ) -> Box<dyn Future<Item = ClientResponse, Error = SendRequestError>>;
/// Send request, returns Response and Framed /// Send request, returns Response and Framed
fn open_tunnel( fn open_tunnel(
@ -49,7 +49,7 @@ where
head: RequestHead, head: RequestHead,
body: Body, body: Body,
addr: Option<net::SocketAddr>, addr: Option<net::SocketAddr>,
) -> Box<Future<Item = ClientResponse, Error = SendRequestError>> { ) -> Box<dyn Future<Item = ClientResponse, Error = SendRequestError>> {
Box::new( Box::new(
self.0 self.0
// connect to the host // connect to the host

View File

@ -23,7 +23,7 @@ type HttpService = BoxedService<ServiceRequest, ServiceResponse, Error>;
type HttpNewService = BoxedNewService<(), ServiceRequest, ServiceResponse, Error, ()>; type HttpNewService = BoxedNewService<(), ServiceRequest, ServiceResponse, Error, ()>;
type BoxedResponse = Either< type BoxedResponse = Either<
FutureResult<ServiceResponse, Error>, FutureResult<ServiceResponse, Error>,
Box<Future<Item = ServiceResponse, Error = Error>>, Box<dyn Future<Item = ServiceResponse, Error = Error>>,
>; >;
type FnDataFactory = Box<Fn() -> Box<dyn Future<Item = Box<DataFactory>, Error = ()>>>; type FnDataFactory = Box<Fn() -> Box<dyn Future<Item = Box<DataFactory>, Error = ()>>>;
@ -297,14 +297,14 @@ impl NewService for AppRoutingFactory {
} }
} }
type HttpServiceFut = Box<Future<Item = HttpService, Error = ()>>; type HttpServiceFut = Box<dyn Future<Item = HttpService, Error = ()>>;
/// Create app service /// Create app service
#[doc(hidden)] #[doc(hidden)]
pub struct AppRoutingFactoryResponse { pub struct AppRoutingFactoryResponse {
fut: Vec<CreateAppRoutingItem>, fut: Vec<CreateAppRoutingItem>,
default: Option<HttpService>, default: Option<HttpService>,
default_fut: Option<Box<Future<Item = HttpService, Error = ()>>>, default_fut: Option<Box<dyn Future<Item = HttpService, Error = ()>>>,
} }
enum CreateAppRoutingItem { enum CreateAppRoutingItem {

View File

@ -94,7 +94,7 @@ where
{ {
type Config = T::Config; type Config = T::Config;
type Error = Error; type Error = Error;
type Future = Box<Future<Item = Option<T>, Error = Error>>; type Future = Box<dyn Future<Item = Option<T>, Error = Error>>;
#[inline] #[inline]
fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future { fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future {
@ -165,7 +165,7 @@ where
{ {
type Config = T::Config; type Config = T::Config;
type Error = Error; type Error = Error;
type Future = Box<Future<Item = Result<T, T::Error>, Error = Error>>; type Future = Box<dyn Future<Item = Result<T, T::Error>, Error = Error>>;
#[inline] #[inline]
fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future { fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future {

View File

@ -119,7 +119,7 @@ where
type Request = ServiceRequest; type Request = ServiceRequest;
type Response = ServiceResponse<B>; type Response = ServiceResponse<B>;
type Error = Error; type Error = Error;
type Future = Box<Future<Item = Self::Response, Error = Self::Error>>; type Future = Box<dyn Future<Item = Self::Response, Error = Self::Error>>;
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {
self.service.poll_ready() self.service.poll_ready()

View File

@ -15,7 +15,7 @@ pub enum ErrorHandlerResponse<B> {
/// New http response got generated /// New http response got generated
Response(ServiceResponse<B>), Response(ServiceResponse<B>),
/// Result is a future that resolves to a new http response /// Result is a future that resolves to a new http response
Future(Box<Future<Item = ServiceResponse<B>, Error = Error>>), Future(Box<dyn Future<Item = ServiceResponse<B>, Error = Error>>),
} }
type ErrorHandler<B> = Fn(ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>>; type ErrorHandler<B> = Fn(ServiceResponse<B>) -> Result<ErrorHandlerResponse<B>>;
@ -117,7 +117,7 @@ where
type Request = ServiceRequest; type Request = ServiceRequest;
type Response = ServiceResponse<B>; type Response = ServiceResponse<B>;
type Error = Error; type Error = Error;
type Future = Box<Future<Item = Self::Response, Error = Self::Error>>; type Future = Box<dyn Future<Item = Self::Response, Error = Self::Error>>;
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {
self.service.poll_ready() self.service.poll_ready()

View File

@ -245,7 +245,7 @@ where
/// ```rust /// ```rust
/// # use actix_web::*; /// # use actix_web::*;
/// # use futures::future::Future; /// # use futures::future::Future;
/// # fn index(req: HttpRequest) -> Box<Future<Item=HttpResponse, Error=Error>> { /// # fn index(req: HttpRequest) -> Box<dyn Future<Item=HttpResponse, Error=Error>> {
/// # unimplemented!() /// # unimplemented!()
/// # } /// # }
/// App::new().service(web::resource("/").route(web::route().to_async(index))); /// App::new().service(web::resource("/").route(web::route().to_async(index)));
@ -478,7 +478,7 @@ pub struct CreateResourceService {
fut: Vec<CreateRouteServiceItem>, fut: Vec<CreateRouteServiceItem>,
data: Option<Rc<Extensions>>, data: Option<Rc<Extensions>>,
default: Option<HttpService>, default: Option<HttpService>,
default_fut: Option<Box<Future<Item = HttpService, Error = ()>>>, default_fut: Option<Box<dyn Future<Item = HttpService, Error = ()>>>,
} }
impl Future for CreateResourceService { impl Future for CreateResourceService {
@ -542,7 +542,7 @@ impl Service for ResourceService {
type Error = Error; type Error = Error;
type Future = Either< type Future = Either<
FutureResult<ServiceResponse, Error>, FutureResult<ServiceResponse, Error>,
Box<Future<Item = ServiceResponse, Error = Error>>, Box<dyn Future<Item = ServiceResponse, Error = Error>>,
>; >;
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {

View File

@ -337,7 +337,7 @@ impl<T: Responder> Future for CustomResponderFut<T> {
/// use actix_web::{Either, Error, HttpResponse}; /// use actix_web::{Either, Error, HttpResponse};
/// ///
/// type RegisterResult = /// type RegisterResult =
/// Either<HttpResponse, Box<Future<Item = HttpResponse, Error = Error>>>; /// Either<HttpResponse, Box<dyn Future<Item = HttpResponse, Error = Error>>>;
/// ///
/// fn index() -> RegisterResult { /// fn index() -> RegisterResult {
/// if is_a_variant() { /// if is_a_variant() {
@ -411,13 +411,13 @@ where
} }
} }
impl<I, E> Responder for Box<Future<Item = I, Error = E>> impl<I, E> Responder for Box<dyn Future<Item = I, Error = E>>
where where
I: Responder + 'static, I: Responder + 'static,
E: Into<Error> + 'static, E: Into<Error> + 'static,
{ {
type Error = Error; type Error = Error;
type Future = Box<Future<Item = Response, Error = Error>>; type Future = Box<dyn Future<Item = Response, Error = Error>>;
#[inline] #[inline]
fn respond_to(self, req: &HttpRequest) -> Self::Future { fn respond_to(self, req: &HttpRequest) -> Self::Future {

View File

@ -19,7 +19,7 @@ type BoxedRouteService<Req, Res> = Box<
Error = Error, Error = Error,
Future = Either< Future = Either<
FutureResult<Res, Error>, FutureResult<Res, Error>,
Box<Future<Item = Res, Error = Error>>, Box<dyn Future<Item = Res, Error = Error>>,
>, >,
>, >,
>; >;
@ -32,7 +32,7 @@ type BoxedRouteNewService<Req, Res> = Box<
Error = Error, Error = Error,
InitError = (), InitError = (),
Service = BoxedRouteService<Req, Res>, Service = BoxedRouteService<Req, Res>,
Future = Box<Future<Item = BoxedRouteService<Req, Res>, Error = ()>>, Future = Box<dyn Future<Item = BoxedRouteService<Req, Res>, Error = ()>>,
>, >,
>; >;
@ -78,8 +78,9 @@ impl NewService for Route {
} }
} }
type RouteFuture = type RouteFuture = Box<
Box<Future<Item = BoxedRouteService<ServiceRequest, ServiceResponse>, Error = ()>>; dyn Future<Item = BoxedRouteService<ServiceRequest, ServiceResponse>, Error = ()>,
>;
pub struct CreateRouteService { pub struct CreateRouteService {
fut: RouteFuture, fut: RouteFuture,
@ -123,7 +124,7 @@ impl Service for RouteService {
type Error = Error; type Error = Error;
type Future = Either< type Future = Either<
FutureResult<Self::Response, Self::Error>, FutureResult<Self::Response, Self::Error>,
Box<Future<Item = Self::Response, Error = Self::Error>>, Box<dyn Future<Item = Self::Response, Error = Self::Error>>,
>; >;
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {
@ -317,7 +318,7 @@ where
type Error = Error; type Error = Error;
type InitError = (); type InitError = ();
type Service = BoxedRouteService<ServiceRequest, Self::Response>; type Service = BoxedRouteService<ServiceRequest, Self::Response>;
type Future = Box<Future<Item = Self::Service, Error = Self::InitError>>; type Future = Box<dyn Future<Item = Self::Service, Error = Self::InitError>>;
fn new_service(&self, _: &()) -> Self::Future { fn new_service(&self, _: &()) -> Self::Future {
Box::new( Box::new(
@ -351,7 +352,7 @@ where
type Error = Error; type Error = Error;
type Future = Either< type Future = Either<
FutureResult<Self::Response, Self::Error>, FutureResult<Self::Response, Self::Error>,
Box<Future<Item = Self::Response, Error = Self::Error>>, Box<dyn Future<Item = Self::Response, Error = Self::Error>>,
>; >;
fn poll_ready(&mut self) -> Poll<(), Self::Error> { fn poll_ready(&mut self) -> Poll<(), Self::Error> {

View File

@ -28,7 +28,7 @@ type HttpService = BoxedService<ServiceRequest, ServiceResponse, Error>;
type HttpNewService = BoxedNewService<(), ServiceRequest, ServiceResponse, Error, ()>; type HttpNewService = BoxedNewService<(), ServiceRequest, ServiceResponse, Error, ()>;
type BoxedResponse = Either< type BoxedResponse = Either<
FutureResult<ServiceResponse, Error>, FutureResult<ServiceResponse, Error>,
Box<Future<Item = ServiceResponse, Error = Error>>, Box<dyn Future<Item = ServiceResponse, Error = Error>>,
>; >;
/// Resources scope. /// Resources scope.
@ -503,10 +503,10 @@ pub struct ScopeFactoryResponse {
fut: Vec<CreateScopeServiceItem>, fut: Vec<CreateScopeServiceItem>,
data: Option<Rc<Extensions>>, data: Option<Rc<Extensions>>,
default: Option<HttpService>, default: Option<HttpService>,
default_fut: Option<Box<Future<Item = HttpService, Error = ()>>>, default_fut: Option<Box<dyn Future<Item = HttpService, Error = ()>>>,
} }
type HttpServiceFut = Box<Future<Item = HttpService, Error = ()>>; type HttpServiceFut = Box<dyn Future<Item = HttpService, Error = ()>>;
enum CreateScopeServiceItem { enum CreateScopeServiceItem {
Future(Option<ResourceDef>, Option<Guards>, HttpServiceFut), Future(Option<ResourceDef>, Option<Guards>, HttpServiceFut),

View File

@ -73,7 +73,7 @@ where
{ {
type Config = FormConfig; type Config = FormConfig;
type Error = Error; type Error = Error;
type Future = Box<Future<Item = Self, Error = Error>>; type Future = Box<dyn Future<Item = Self, Error = Error>>;
#[inline] #[inline]
fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future { fn from_request(req: &HttpRequest, payload: &mut Payload) -> Self::Future {
@ -187,7 +187,7 @@ pub struct UrlEncoded<U> {
length: Option<usize>, length: Option<usize>,
encoding: &'static Encoding, encoding: &'static Encoding,
err: Option<UrlencodedError>, err: Option<UrlencodedError>,
fut: Option<Box<Future<Item = U, Error = UrlencodedError>>>, fut: Option<Box<dyn Future<Item = U, Error = UrlencodedError>>>,
} }
impl<U> UrlEncoded<U> { impl<U> UrlEncoded<U> {

View File

@ -169,7 +169,7 @@ where
T: DeserializeOwned + 'static, T: DeserializeOwned + 'static,
{ {
type Error = Error; type Error = Error;
type Future = Box<Future<Item = Self, Error = Error>>; type Future = Box<dyn Future<Item = Self, Error = Error>>;
type Config = JsonConfig; type Config = JsonConfig;
#[inline] #[inline]
@ -290,7 +290,7 @@ pub struct JsonBody<U> {
length: Option<usize>, length: Option<usize>,
stream: Option<Decompress<Payload>>, stream: Option<Decompress<Payload>>,
err: Option<JsonPayloadError>, err: Option<JsonPayloadError>,
fut: Option<Box<Future<Item = U, Error = JsonPayloadError>>>, fut: Option<Box<dyn Future<Item = U, Error = JsonPayloadError>>>,
} }
impl<U> JsonBody<U> impl<U> JsonBody<U>

View File

@ -124,7 +124,7 @@ impl FromRequest for Bytes {
type Config = PayloadConfig; type Config = PayloadConfig;
type Error = Error; type Error = Error;
type Future = type Future =
Either<Box<Future<Item = Bytes, Error = Error>>, FutureResult<Bytes, Error>>; Either<Box<dyn Future<Item = Bytes, Error = Error>>, FutureResult<Bytes, Error>>;
#[inline] #[inline]
fn from_request(req: &HttpRequest, payload: &mut dev::Payload) -> Self::Future { fn from_request(req: &HttpRequest, payload: &mut dev::Payload) -> Self::Future {
@ -177,8 +177,10 @@ impl FromRequest for Bytes {
impl FromRequest for String { impl FromRequest for String {
type Config = PayloadConfig; type Config = PayloadConfig;
type Error = Error; type Error = Error;
type Future = type Future = Either<
Either<Box<Future<Item = String, Error = Error>>, FutureResult<String, Error>>; Box<dyn Future<Item = String, Error = Error>>,
FutureResult<String, Error>,
>;
#[inline] #[inline]
fn from_request(req: &HttpRequest, payload: &mut dev::Payload) -> Self::Future { fn from_request(req: &HttpRequest, payload: &mut dev::Payload) -> Self::Future {
@ -291,7 +293,7 @@ pub struct HttpMessageBody {
length: Option<usize>, length: Option<usize>,
stream: Option<dev::Decompress<dev::Payload>>, stream: Option<dev::Decompress<dev::Payload>>,
err: Option<PayloadError>, err: Option<PayloadError>,
fut: Option<Box<Future<Item = Bytes, Error = PayloadError>>>, fut: Option<Box<dyn Future<Item = Bytes, Error = PayloadError>>>,
} }
impl HttpMessageBody { impl HttpMessageBody {