mirror of https://github.com/fafhrd91/actix-web
remove generic type B for app::App
This commit is contained in:
parent
2a2474ca09
commit
6f4bd9042f
|
@ -1,6 +1,10 @@
|
||||||
# Changes
|
# Changes
|
||||||
|
|
||||||
## Unreleased - 2020-xx-xx
|
## 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
|
## 3.0.2 - 2020-09-15
|
||||||
|
|
17
src/app.rs
17
src/app.rs
|
@ -1,10 +1,9 @@
|
||||||
use std::cell::RefCell;
|
use std::cell::RefCell;
|
||||||
use std::fmt;
|
use std::fmt;
|
||||||
use std::future::Future;
|
use std::future::Future;
|
||||||
use std::marker::PhantomData;
|
|
||||||
use std::rc::Rc;
|
use std::rc::Rc;
|
||||||
|
|
||||||
use actix_http::body::{Body, MessageBody};
|
use actix_http::body::MessageBody;
|
||||||
use actix_http::Extensions;
|
use actix_http::Extensions;
|
||||||
use actix_service::boxed::{self, BoxServiceFactory};
|
use actix_service::boxed::{self, BoxServiceFactory};
|
||||||
use actix_service::{
|
use actix_service::{
|
||||||
|
@ -28,7 +27,7 @@ type HttpNewService = BoxServiceFactory<(), ServiceRequest, ServiceResponse, Err
|
||||||
|
|
||||||
/// Application builder - structure that follows the builder pattern
|
/// Application builder - structure that follows the builder pattern
|
||||||
/// for building application instances.
|
/// for building application instances.
|
||||||
pub struct App<T, B> {
|
pub struct App<T> {
|
||||||
endpoint: T,
|
endpoint: T,
|
||||||
services: Vec<Box<dyn AppServiceFactory>>,
|
services: Vec<Box<dyn AppServiceFactory>>,
|
||||||
default: Option<Rc<HttpNewService>>,
|
default: Option<Rc<HttpNewService>>,
|
||||||
|
@ -37,10 +36,9 @@ pub struct App<T, B> {
|
||||||
data_factories: Vec<FnDataFactory>,
|
data_factories: Vec<FnDataFactory>,
|
||||||
external: Vec<ResourceDef>,
|
external: Vec<ResourceDef>,
|
||||||
extensions: Extensions,
|
extensions: Extensions,
|
||||||
_t: PhantomData<B>,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl App<AppEntry, Body> {
|
impl App<AppEntry> {
|
||||||
/// Create application builder. Application can be configured with a builder-like pattern.
|
/// Create application builder. Application can be configured with a builder-like pattern.
|
||||||
#[allow(clippy::new_without_default)]
|
#[allow(clippy::new_without_default)]
|
||||||
pub fn new() -> Self {
|
pub fn new() -> Self {
|
||||||
|
@ -54,12 +52,11 @@ impl App<AppEntry, Body> {
|
||||||
factory_ref: fref,
|
factory_ref: fref,
|
||||||
external: Vec::new(),
|
external: Vec::new(),
|
||||||
extensions: Extensions::new(),
|
extensions: Extensions::new(),
|
||||||
_t: PhantomData,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, B> App<T, B>
|
impl<T, B> App<T>
|
||||||
where
|
where
|
||||||
B: MessageBody,
|
B: MessageBody,
|
||||||
T: ServiceFactory<
|
T: ServiceFactory<
|
||||||
|
@ -358,7 +355,6 @@ where
|
||||||
Error = Error,
|
Error = Error,
|
||||||
InitError = (),
|
InitError = (),
|
||||||
>,
|
>,
|
||||||
B1,
|
|
||||||
>
|
>
|
||||||
where
|
where
|
||||||
M: Transform<
|
M: Transform<
|
||||||
|
@ -379,7 +375,6 @@ where
|
||||||
factory_ref: self.factory_ref,
|
factory_ref: self.factory_ref,
|
||||||
external: self.external,
|
external: self.external,
|
||||||
extensions: self.extensions,
|
extensions: self.extensions,
|
||||||
_t: PhantomData,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +420,6 @@ where
|
||||||
Error = Error,
|
Error = Error,
|
||||||
InitError = (),
|
InitError = (),
|
||||||
>,
|
>,
|
||||||
B1,
|
|
||||||
>
|
>
|
||||||
where
|
where
|
||||||
B1: MessageBody,
|
B1: MessageBody,
|
||||||
|
@ -441,12 +435,11 @@ where
|
||||||
factory_ref: self.factory_ref,
|
factory_ref: self.factory_ref,
|
||||||
external: self.external,
|
external: self.external,
|
||||||
extensions: self.extensions,
|
extensions: self.extensions,
|
||||||
_t: PhantomData,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<T, B> IntoServiceFactory<AppInit<T, B>> for App<T, B>
|
impl<T, B> IntoServiceFactory<AppInit<T, B>> for App<T>
|
||||||
where
|
where
|
||||||
B: MessageBody,
|
B: MessageBody,
|
||||||
T: ServiceFactory<
|
T: ServiceFactory<
|
||||||
|
|
Loading…
Reference in New Issue