mirror of
https://github.com/fafhrd91/actix-web
synced 2024-11-28 01:52:57 +01:00
allow to create http services with config
This commit is contained in:
parent
3b069e0568
commit
6d639ae3df
@ -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.
|
/// Create builder for `HttpService` instance.
|
||||||
pub fn build() -> H2ServiceBuilder<T, S> {
|
pub fn build() -> H2ServiceBuilder<T, S> {
|
||||||
H2ServiceBuilder::new()
|
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.
|
/// Create builder for `HttpService` instance.
|
||||||
pub fn build() -> HttpServiceBuilder<T, S> {
|
pub fn build() -> HttpServiceBuilder<T, S> {
|
||||||
HttpServiceBuilder::new()
|
HttpServiceBuilder::new()
|
||||||
|
Loading…
Reference in New Issue
Block a user