mirror of
https://github.com/fafhrd91/actix-web
synced 2025-08-19 12:25:37 +02:00
revert generic request parameter for service; support ServerConfig as new factory config
This commit is contained in:
@@ -66,7 +66,7 @@ impl<P, T> Resource<P, T>
|
||||
where
|
||||
P: 'static,
|
||||
T: NewService<
|
||||
ServiceRequest<P>,
|
||||
Request = ServiceRequest<P>,
|
||||
Response = ServiceResponse,
|
||||
Error = (),
|
||||
InitError = (),
|
||||
@@ -220,7 +220,7 @@ where
|
||||
) -> Resource<
|
||||
P,
|
||||
impl NewService<
|
||||
ServiceRequest<P>,
|
||||
Request = ServiceRequest<P>,
|
||||
Response = ServiceResponse,
|
||||
Error = (),
|
||||
InitError = (),
|
||||
@@ -229,12 +229,12 @@ where
|
||||
where
|
||||
M: Transform<
|
||||
T::Service,
|
||||
ServiceRequest<P>,
|
||||
Request = ServiceRequest<P>,
|
||||
Response = ServiceResponse,
|
||||
Error = (),
|
||||
InitError = (),
|
||||
>,
|
||||
F: IntoTransform<M, T::Service, ServiceRequest<P>>,
|
||||
F: IntoTransform<M, T::Service>,
|
||||
{
|
||||
let endpoint = ApplyTransform::new(mw, self.endpoint);
|
||||
Resource {
|
||||
@@ -251,9 +251,12 @@ where
|
||||
pub fn default_resource<F, R, U>(mut self, f: F) -> Self
|
||||
where
|
||||
F: FnOnce(Resource<P>) -> R,
|
||||
R: IntoNewService<U, ServiceRequest<P>>,
|
||||
U: NewService<ServiceRequest<P>, Response = ServiceResponse, Error = ()>
|
||||
+ 'static,
|
||||
R: IntoNewService<U>,
|
||||
U: NewService<
|
||||
Request = ServiceRequest<P>,
|
||||
Response = ServiceResponse,
|
||||
Error = (),
|
||||
> + 'static,
|
||||
{
|
||||
// create and configure default resource
|
||||
self.default = Rc::new(RefCell::new(Some(Rc::new(boxed::new_service(
|
||||
@@ -268,7 +271,7 @@ impl<P, T> HttpServiceFactory<P> for Resource<P, T>
|
||||
where
|
||||
P: 'static,
|
||||
T: NewService<
|
||||
ServiceRequest<P>,
|
||||
Request = ServiceRequest<P>,
|
||||
Response = ServiceResponse,
|
||||
Error = (),
|
||||
InitError = (),
|
||||
@@ -292,10 +295,10 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
impl<P, T> IntoNewService<T, ServiceRequest<P>> for Resource<P, T>
|
||||
impl<P, T> IntoNewService<T> for Resource<P, T>
|
||||
where
|
||||
T: NewService<
|
||||
ServiceRequest<P>,
|
||||
Request = ServiceRequest<P>,
|
||||
Response = ServiceResponse,
|
||||
Error = (),
|
||||
InitError = (),
|
||||
@@ -316,7 +319,8 @@ pub struct ResourceFactory<P> {
|
||||
default: Rc<RefCell<Option<Rc<HttpNewService<P>>>>>,
|
||||
}
|
||||
|
||||
impl<P: 'static> NewService<ServiceRequest<P>> for ResourceFactory<P> {
|
||||
impl<P: 'static> NewService for ResourceFactory<P> {
|
||||
type Request = ServiceRequest<P>;
|
||||
type Response = ServiceResponse;
|
||||
type Error = ();
|
||||
type InitError = ();
|
||||
@@ -406,7 +410,8 @@ pub struct ResourceService<P> {
|
||||
default: Option<HttpService<P>>,
|
||||
}
|
||||
|
||||
impl<P> Service<ServiceRequest<P>> for ResourceService<P> {
|
||||
impl<P> Service for ResourceService<P> {
|
||||
type Request = ServiceRequest<P>;
|
||||
type Response = ServiceResponse;
|
||||
type Error = ();
|
||||
type Future = Either<
|
||||
@@ -450,7 +455,8 @@ impl<P> ResourceEndpoint<P> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<P: 'static> NewService<ServiceRequest<P>> for ResourceEndpoint<P> {
|
||||
impl<P: 'static> NewService for ResourceEndpoint<P> {
|
||||
type Request = ServiceRequest<P>;
|
||||
type Response = ServiceResponse;
|
||||
type Error = ();
|
||||
type InitError = ();
|
||||
|
Reference in New Issue
Block a user