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:
@ -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),
|
||||
}
|
||||
}
|
||||
|
@ -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(),
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user