From 6f4bd9042f09ef313b6d65c34e08b82d466c0a8f Mon Sep 17 00:00:00 2001 From: fakeshadow <24548779@qq.com> Date: Fri, 18 Sep 2020 17:53:04 +0800 Subject: [PATCH] remove generic type B for app::App --- CHANGES.md | 4 ++++ src/app.rs | 17 +++++------------ 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 15d3c81ce..93a285bfe 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,6 +1,10 @@ # Changes ## Unreleased - 2020-xx-xx +### Changed +* remove generic type `B` for `app::App` and it's not bound to `actix_http::body::MessageBody` trait anymore. [#1692] + +[#1692]: https://github.com/actix/actix-web/pull/1692 ## 3.0.2 - 2020-09-15 diff --git a/src/app.rs b/src/app.rs index fdedb0a75..cefd36869 100644 --- a/src/app.rs +++ b/src/app.rs @@ -1,10 +1,9 @@ use std::cell::RefCell; use std::fmt; use std::future::Future; -use std::marker::PhantomData; use std::rc::Rc; -use actix_http::body::{Body, MessageBody}; +use actix_http::body::MessageBody; use actix_http::Extensions; use actix_service::boxed::{self, BoxServiceFactory}; use actix_service::{ @@ -28,7 +27,7 @@ type HttpNewService = BoxServiceFactory<(), ServiceRequest, ServiceResponse, Err /// Application builder - structure that follows the builder pattern /// for building application instances. -pub struct App { +pub struct App { endpoint: T, services: Vec>, default: Option>, @@ -37,10 +36,9 @@ pub struct App { data_factories: Vec, external: Vec, extensions: Extensions, - _t: PhantomData, } -impl App { +impl App { /// Create application builder. Application can be configured with a builder-like pattern. #[allow(clippy::new_without_default)] pub fn new() -> Self { @@ -54,12 +52,11 @@ impl App { factory_ref: fref, external: Vec::new(), extensions: Extensions::new(), - _t: PhantomData, } } } -impl App +impl App where B: MessageBody, T: ServiceFactory< @@ -358,7 +355,6 @@ where Error = Error, InitError = (), >, - B1, > where M: Transform< @@ -379,7 +375,6 @@ where factory_ref: self.factory_ref, external: self.external, extensions: self.extensions, - _t: PhantomData, } } @@ -425,7 +420,6 @@ where Error = Error, InitError = (), >, - B1, > where B1: MessageBody, @@ -441,12 +435,11 @@ where factory_ref: self.factory_ref, external: self.external, extensions: self.extensions, - _t: PhantomData, } } } -impl IntoServiceFactory> for App +impl IntoServiceFactory> for App where B: MessageBody, T: ServiceFactory<