1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-26 19:47:43 +02:00

use owned value for service factory config

This commit is contained in:
Nikolay Kim
2019-12-02 21:27:48 +06:00
parent 3385682e09
commit 9ed35cca7a
30 changed files with 112 additions and 143 deletions

View File

@ -63,6 +63,7 @@ impl<A, B> Either<A, B> {
pub fn new(left: A, right: B) -> Either<A, B>
where
A: ServiceFactory,
A::Config: Clone,
B: ServiceFactory<
Config = A::Config,
Response = A::Response,
@ -77,6 +78,7 @@ impl<A, B> Either<A, B> {
impl<A, B> ServiceFactory for Either<A, B>
where
A: ServiceFactory,
A::Config: Clone,
B: ServiceFactory<
Config = A::Config,
Response = A::Response,
@ -92,11 +94,11 @@ where
type Service = EitherService<A::Service, B::Service>;
type Future = EitherNewService<A, B>;
fn new_service(&self, cfg: &A::Config) -> Self::Future {
fn new_service(&self, cfg: A::Config) -> Self::Future {
EitherNewService {
left: None,
right: None,
left_fut: self.left.new_service(cfg),
left_fut: self.left.new_service(cfg.clone()),
right_fut: self.right.new_service(cfg),
}
}

View File

@ -58,7 +58,7 @@ where
type Service = KeepAliveService<R, E, F>;
type Future = Ready<Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: &()) -> Self::Future {
fn new_service(&self, _: ()) -> Self::Future {
ok(KeepAliveService::new(
self.ka,
self.time.timer(),

View File

@ -51,7 +51,7 @@ impl ServiceFactory for LowResTime {
type Service = LowResTimeService;
type Future = Ready<Result<Self::Service, Self::InitError>>;
fn new_service(&self, _: &()) -> Self::Future {
fn new_service(&self, _: ()) -> Self::Future {
ok(self.timer())
}
}