pub struct Group<S, E>(/* private fields */);Expand description
middleware builder type for grouping and nesting multiple middlewares.
§Examples
// a simple passthrough middleware function.
async fn mw<S, Req>(svc: &S, req: Req) -> Result<S::Response, S::Error>
where
S: Service<Req>
{
svc.call(req).await
}
fn_service(|_: ()| async { Ok::<_, Infallible>(()) })
.enclosed(
// group multiple middlewares and apply it to fn_service.
Group::new()
.enclosed_fn(mw)
.enclosed_fn(mw)
);Implementations§
Trait Implementations§
impl<S, E> Copy for Group<S, E>
Auto Trait Implementations§
impl<S, E> Freeze for Group<S, E>
impl<S, E> RefUnwindSafe for Group<S, E>
impl<S, E> Send for Group<S, E>
impl<S, E> Sync for Group<S, E>
impl<S, E> Unpin for Group<S, E>
impl<S, E> UnwindSafe for Group<S, E>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<S, Arg> ServiceExt<Arg> for Swhere
S: Service<Arg>,
impl<S, Arg> ServiceExt<Arg> for Swhere
S: Service<Arg>,
Source§fn enclosed<T>(self, build: T) -> EnclosedBuilder<Self, T>
fn enclosed<T>(self, build: T) -> EnclosedBuilder<Self, T>
Enclose Self with given
T as Service<<Self as Service<_>>::Response>>. In other word T
would take Self’s Service::Response type as it’s generic argument of Service<_> impl.Source§fn enclosed_fn<T, Req, O>(self, func: T) -> EnclosedFnBuilder<Self, T>
fn enclosed_fn<T, Req, O>(self, func: T) -> EnclosedFnBuilder<Self, T>
Function version of Self::enclosed method.
Source§fn map<F, Res, ResMap>(self, mapper: F) -> MapBuilder<Self, F>
fn map<F, Res, ResMap>(self, mapper: F) -> MapBuilder<Self, F>
Mutate
<<Self::Response as Service<Req>>::Future as Future>::Output type with given
closure.Source§fn map_err<F, Err, ErrMap>(self, err: F) -> MapErrorBuilder<Self, F>
fn map_err<F, Err, ErrMap>(self, err: F) -> MapErrorBuilder<Self, F>
Mutate
<Self::Response as Service<Req>>::Error type with given closure.