1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-01-31 13:52:08 +01:00

fix map_err constraints

This commit is contained in:
Nikolay Kim 2019-03-12 13:45:05 -07:00
parent 755d4958c5
commit e7465bfa2e
2 changed files with 14 additions and 10 deletions

View File

@ -335,7 +335,7 @@ pub trait NewService<Config = ()> {
fn map_err<F, E>(self, f: F) -> MapErrNewService<Self, F, E, Config> fn map_err<F, E>(self, f: F) -> MapErrNewService<Self, F, E, Config>
where where
Self: Sized, Self: Sized,
F: Fn(Self::Error) -> E, F: Fn(Self::Error) -> E + Clone,
{ {
MapErrNewService::new(self, f) MapErrNewService::new(self, f)
} }

View File

@ -98,19 +98,23 @@ where
/// service's error. /// service's error.
/// ///
/// This is created by the `NewServiceExt::map_err` method. /// This is created by the `NewServiceExt::map_err` method.
pub struct MapErrNewService<A, F, E, C> { pub struct MapErrNewService<A, F, E, C>
where
A: NewService<C>,
F: Fn(A::Error) -> E + Clone,
{
a: A, a: A,
f: F, f: F,
e: PhantomData<(E, C)>, e: PhantomData<(E, C)>,
} }
impl<A, F, E, C> MapErrNewService<A, F, E, C> { impl<A, F, E, C> MapErrNewService<A, F, E, C>
where
A: NewService<C>,
F: Fn(A::Error) -> E + Clone,
{
/// Create new `MapErr` new service instance /// Create new `MapErr` new service instance
pub fn new(a: A, f: F) -> Self pub fn new(a: A, f: F) -> Self {
where
A: NewService<C>,
F: Fn(A::Error) -> E,
{
Self { Self {
a, a,
f, f,
@ -121,8 +125,8 @@ impl<A, F, E, C> MapErrNewService<A, F, E, C> {
impl<A, F, E, C> Clone for MapErrNewService<A, F, E, C> impl<A, F, E, C> Clone for MapErrNewService<A, F, E, C>
where where
A: Clone, A: NewService<C> + Clone,
F: Clone, F: Fn(A::Error) -> E + Clone,
{ {
fn clone(&self) -> Self { fn clone(&self) -> Self {
Self { Self {