diff --git a/src/app_service.rs b/src/app_service.rs index 6f9150379..bca8f2629 100644 --- a/src/app_service.rs +++ b/src/app_service.rs @@ -13,7 +13,8 @@ use crate::{ request::{HttpRequest, HttpRequestPool}, rmap::ResourceMap, service::{ - AppServiceFactory, HttpService, HttpServiceFactory, ServiceRequest, ServiceResponse, + AppServiceFactory, BoxedHttpService, BoxedHttpServiceFactory, ServiceRequest, + ServiceResponse, }, Error, HttpResponse, }; @@ -36,7 +37,7 @@ where pub(crate) extensions: RefCell>, pub(crate) async_data_factories: Rc<[FnDataFactory]>, pub(crate) services: Rc>>>, - pub(crate) default: Option>, + pub(crate) default: Option>, pub(crate) factory_ref: Rc>>, pub(crate) external: RefCell>, } @@ -227,8 +228,14 @@ where } pub struct AppRoutingFactory { - services: Rc<[(ResourceDef, HttpServiceFactory, RefCell>)]>, - default: Rc, + services: Rc< + [( + ResourceDef, + BoxedHttpServiceFactory, + RefCell>, + )], + >, + default: Rc, } impl ServiceFactory for AppRoutingFactory { @@ -276,8 +283,8 @@ impl ServiceFactory for AppRoutingFactory { /// The Actix Web router default entry point. pub struct AppRouting { - router: Router, - default: HttpService, + router: Router, + default: BoxedHttpService, } impl Service for AppRouting { diff --git a/src/resource.rs b/src/resource.rs index f59a1a01a..a025a8943 100644 --- a/src/resource.rs +++ b/src/resource.rs @@ -14,12 +14,15 @@ use futures_util::future::join_all; use crate::{ data::Data, - dev::{ensure_leading_slash, AppService, HttpServiceFactory, ResourceDef}, + dev::{ensure_leading_slash, AppService, ResourceDef}, guard::Guard, handler::Handler, responder::Responder, route::{Route, RouteService}, - service::{HttpService, HttpServiceFactory, ServiceRequest, ServiceResponse}, + service::{ + BoxedHttpService, BoxedHttpServiceFactory, HttpServiceFactory, ServiceRequest, + ServiceResponse, + }, Error, FromRequest, HttpResponse, }; @@ -52,7 +55,7 @@ pub struct Resource { routes: Vec, app_data: Option, guards: Vec>, - default: HttpServiceFactory, + default: BoxedHttpServiceFactory, factory_ref: Rc>>, } @@ -418,7 +421,7 @@ where pub struct ResourceFactory { routes: Vec, - default: HttpServiceFactory, + default: BoxedHttpServiceFactory, } impl ServiceFactory for ResourceFactory { @@ -450,7 +453,7 @@ impl ServiceFactory for ResourceFactory { pub struct ResourceService { routes: Vec, - default: HttpService, + default: BoxedHttpService, } impl Service for ResourceService { diff --git a/src/scope.rs b/src/scope.rs index 352e48cf6..bd7e2d735 100644 --- a/src/scope.rs +++ b/src/scope.rs @@ -12,12 +12,12 @@ use futures_util::future::join_all; use crate::{ config::ServiceConfig, data::Data, - dev::{AppService, HttpServiceFactory}, + dev::AppService, guard::Guard, rmap::ResourceMap, service::{ - AppServiceFactory, HttpService, HttpServiceFactory, ServiceFactoryWrapper, - ServiceRequest, ServiceResponse, + AppServiceFactory, BoxedHttpService, BoxedHttpServiceFactory, HttpServiceFactory, + ServiceFactoryWrapper, ServiceRequest, ServiceResponse, }, Error, Resource, Route, }; @@ -58,7 +58,7 @@ pub struct Scope { app_data: Option, services: Vec>, guards: Vec>, - default: Option>, + default: Option>, external: Vec, factory_ref: Rc>>, } @@ -470,8 +470,14 @@ where } pub struct ScopeFactory { - services: Rc<[(ResourceDef, HttpServiceFactory, RefCell>)]>, - default: Rc, + services: Rc< + [( + ResourceDef, + BoxedHttpServiceFactory, + RefCell>, + )], + >, + default: Rc, } impl ServiceFactory for ScopeFactory { @@ -518,8 +524,8 @@ impl ServiceFactory for ScopeFactory { } pub struct ScopeService { - router: Router>>, - default: HttpService, + router: Router>>, + default: BoxedHttpService, } impl Service for ScopeService { diff --git a/src/service.rs b/src/service.rs index c60f8e1fc..fbbb889bc 100644 --- a/src/service.rs +++ b/src/service.rs @@ -24,8 +24,8 @@ use crate::{ Error, HttpRequest, HttpResponse, }; -pub(crate) type HttpService = BoxService; -pub(crate) type HttpServiceFactory = +pub(crate) type BoxedHttpService = BoxService; +pub(crate) type BoxedHttpServiceFactory = BoxServiceFactory<(), ServiceRequest, ServiceResponse, Error, ()>; pub trait HttpServiceFactory {