1
0
Fork 0
mirror of https://github.com/actix/actix-web.git synced 2024-06-02 13:29:24 +00: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()