motore 0.4.1

Motore is a library of modular and reusable components for building robust clients and servers. Motore is greatly inspired by Tower.
Documentation
use crate::{layer::Layer, service::MapErr};

pub struct MapErrLayer<F> {
    pub(crate) f: F,
}

impl<F> MapErrLayer<F> {
    pub fn new(f: F) -> Self {
        MapErrLayer { f }
    }
}

impl<S, F: Clone> Layer<S> for MapErrLayer<F> {
    type Service = MapErr<S, F>;

    fn layer(self, svc: S) -> Self::Service {
        MapErr {
            inner: svc,
            f: self.f,
        }
    }
}