diff --git a/src/h2/service.rs b/src/h2/service.rs index a47f507b5..530629947 100644 --- a/src/h2/service.rs +++ b/src/h2/service.rs @@ -47,6 +47,18 @@ where } } + /// Create new `HttpService` instance with config. + pub fn with_config>( + cfg: ServiceConfig, + service: F, + ) -> Self { + H2Service { + cfg, + srv: service.into_new_service(), + _t: PhantomData, + } + } + /// Create builder for `HttpService` instance. pub fn build() -> H2ServiceBuilder { H2ServiceBuilder::new() diff --git a/src/service/service.rs b/src/service/service.rs index 5f6ee8190..3d0009ed0 100644 --- a/src/service/service.rs +++ b/src/service/service.rs @@ -44,6 +44,18 @@ where } } + /// Create new `HttpService` instance with config. + pub fn with_config>( + cfg: ServiceConfig, + service: F, + ) -> Self { + HttpService { + cfg, + srv: service.into_new_service(), + _t: PhantomData, + } + } + /// Create builder for `HttpService` instance. pub fn build() -> HttpServiceBuilder { HttpServiceBuilder::new()