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

change Either constructor

This commit is contained in:
Nikolay Kim
2019-05-14 17:32:50 -07:00
parent 837504c10f
commit 0a6cded975
3 changed files with 25 additions and 19 deletions

View File

@ -1,5 +1,12 @@
# Changes
##[0.4.1] - 2019-05-xx
### Changed
* Change `Either` constructor
## [0.4.0] - 2019-05-11
### Changed

View File

@ -57,25 +57,21 @@ pub struct Either<A, B> {
}
impl<A, B> Either<A, B> {
pub fn new_a<F>(srv: F) -> Either<A, ()>
pub fn new<F1, F2>(srv_a: F1, srv_b: F2) -> Either<A, B>
where
A: NewService,
F: IntoNewService<A>,
B: NewService<
Config = A::Config,
Response = A::Response,
Error = A::Error,
InitError = A::InitError,
>,
F1: IntoNewService<A>,
F2: IntoNewService<B>,
{
Either {
left: srv.into_new_service(),
right: (),
}
}
pub fn new_b<F>(srv: F) -> Either<(), B>
where
B: NewService,
F: IntoNewService<B>,
{
Either {
left: (),
right: srv.into_new_service(),
left: srv_a.into_new_service(),
right: srv_b.into_new_service(),
}
}
}