mirror of
https://github.com/fafhrd91/actix-net
synced 2025-01-31 11:32:10 +01:00
fix map_err constraints
This commit is contained in:
parent
755d4958c5
commit
e7465bfa2e
@ -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)
|
||||||
}
|
}
|
||||||
|
@ -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>
|
||||||
/// Create new `MapErr` new service instance
|
|
||||||
pub fn new(a: A, f: F) -> Self
|
|
||||||
where
|
where
|
||||||
A: NewService<C>,
|
A: NewService<C>,
|
||||||
F: Fn(A::Error) -> E,
|
F: Fn(A::Error) -> E + Clone,
|
||||||
{
|
{
|
||||||
|
/// Create new `MapErr` new service instance
|
||||||
|
pub fn new(a: A, f: F) -> Self {
|
||||||
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 {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user