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:
@ -1,5 +1,12 @@
|
||||
# Changes
|
||||
|
||||
##[0.4.1] - 2019-05-xx
|
||||
|
||||
### Changed
|
||||
|
||||
* Change `Either` constructor
|
||||
|
||||
|
||||
## [0.4.0] - 2019-05-11
|
||||
|
||||
### Changed
|
||||
|
@ -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(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user