mirror of
https://github.com/fafhrd91/actix-net
synced 2024-11-27 23:42:56 +01:00
enforce constraints on AndThenNewService type
This commit is contained in:
parent
e7465bfa2e
commit
2c1f8f0b96
@ -107,19 +107,23 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// `AndThenNewService` new service combinator
|
/// `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,
|
a: A,
|
||||||
b: B,
|
b: B,
|
||||||
_t: PhantomData<C>,
|
_t: PhantomData<C>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<A, B, C> AndThenNewService<A, B, C> {
|
impl<A, B, C> AndThenNewService<A, B, C>
|
||||||
/// Create new `AndThen` combinator
|
where
|
||||||
pub fn new<F: IntoNewService<B, C>>(a: A, f: F) -> Self
|
|
||||||
where
|
|
||||||
A: NewService<C>,
|
A: NewService<C>,
|
||||||
B: NewService<C, Request = A::Response, Error = A::Error, InitError = A::InitError>,
|
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 {
|
Self {
|
||||||
a,
|
a,
|
||||||
b: f.into_new_service(),
|
b: f.into_new_service(),
|
||||||
@ -148,8 +152,8 @@ where
|
|||||||
|
|
||||||
impl<A, B, C> Clone for AndThenNewService<A, B, C>
|
impl<A, B, C> Clone for AndThenNewService<A, B, C>
|
||||||
where
|
where
|
||||||
A: Clone,
|
A: NewService<C> + Clone,
|
||||||
B: Clone,
|
B: NewService<C, Request = A::Response, Error = A::Error, InitError = A::InitError> + Clone,
|
||||||
{
|
{
|
||||||
fn clone(&self) -> Self {
|
fn clone(&self) -> Self {
|
||||||
Self {
|
Self {
|
||||||
|
Loading…
Reference in New Issue
Block a user