mirror of
https://github.com/actix/actix-web.git
synced 2025-02-21 05:16:17 +00:00
allow to create http services with config
This commit is contained in:
parent
3b069e0568
commit
6d639ae3df
2 changed files with 24 additions and 0 deletions
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue