1
0
mirror of https://github.com/actix/actix-extras.git synced 2024-11-30 18:34:36 +01:00

allow to create http services with config

This commit is contained in:
Nikolay Kim 2019-03-06 22:59:56 -08:00
parent 3b069e0568
commit 6d639ae3df
2 changed files with 24 additions and 0 deletions

View File

@ -47,6 +47,18 @@ where
}
}
/// Create new `HttpService` instance with config.
pub fn with_config<F: IntoNewService<S, Request>>(
cfg: ServiceConfig,
service: F,
) -> Self {
H2Service {
cfg,
srv: service.into_new_service(),
_t: PhantomData,
}
}
/// Create builder for `HttpService` instance.
pub fn build() -> H2ServiceBuilder<T, S> {
H2ServiceBuilder::new()

View File

@ -44,6 +44,18 @@ where
}
}
/// Create new `HttpService` instance with config.
pub fn with_config<F: IntoNewService<S, Request>>(
cfg: ServiceConfig,
service: F,
) -> Self {
HttpService {
cfg,
srv: service.into_new_service(),
_t: PhantomData,
}
}
/// Create builder for `HttpService` instance.
pub fn build() -> HttpServiceBuilder<T, S> {
HttpServiceBuilder::new()