1
0
mirror of https://github.com/fafhrd91/actix-net synced 2024-11-27 19:12:56 +01:00

enforce constraints on AndThenNewService type

This commit is contained in:
Nikolay Kim 2019-03-12 13:50:14 -07:00
parent e7465bfa2e
commit 2c1f8f0b96

View File

@ -107,19 +107,23 @@ where
}
/// `AndThenNewService` new service combinator
pub struct AndThenNewService<A, B, C> {
pub struct AndThenNewService<A, B, C>
where
A: NewService<C>,
B: NewService<C, Request = A::Response, Error = A::Error, InitError = A::InitError>,
{
a: A,
b: B,
_t: PhantomData<C>,
}
impl<A, B, C> AndThenNewService<A, B, C> {
/// Create new `AndThen` combinator
pub fn new<F: IntoNewService<B, C>>(a: A, f: F) -> Self
impl<A, B, C> AndThenNewService<A, B, C>
where
A: NewService<C>,
B: NewService<C, Request = A::Response, Error = A::Error, InitError = A::InitError>,
{
/// Create new `AndThen` combinator
pub fn new<F: IntoNewService<B, C>>(a: A, f: F) -> Self {
Self {
a,
b: f.into_new_service(),
@ -148,8 +152,8 @@ where
impl<A, B, C> Clone for AndThenNewService<A, B, C>
where
A: Clone,
B: Clone,
A: NewService<C> + Clone,
B: NewService<C, Request = A::Response, Error = A::Error, InitError = A::InitError> + Clone,
{
fn clone(&self) -> Self {
Self {