pub struct FnMiddleware<F, S, St, Req, In, Out, Err> { /* private fields */ }Expand description
Middleware backed by an asynchronous function.
Created by fn_layer. Each Middleware::create call wraps the supplied
service in Apply with a clone of the function. The construction state
is not captured automatically; the function accesses current pipeline state
through ApplyCtx::st.
The function controls whether and how often the inner service is called.
Binding, readiness, and shutdown follow Apply, including conversion of
inner readiness errors through From. Cloning this middleware clones only
the function, not an inner service.
Trait Implementations§
Source§impl<F, S, St, Req, In, Out, Err> Clone for FnMiddleware<F, S, St, Req, In, Out, Err>where
F: Clone,
impl<F, S, St, Req, In, Out, Err> Clone for FnMiddleware<F, S, St, Req, In, Out, Err>where
F: Clone,
Source§fn clone(&self) -> FnMiddleware<F, S, St, Req, In, Out, Err>
fn clone(&self) -> FnMiddleware<F, S, St, Req, In, Out, Err>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<F, S, St, Req, In, Out, Err> Debug for FnMiddleware<F, S, St, Req, In, Out, Err>
impl<F, S, St, Req, In, Out, Err> Debug for FnMiddleware<F, S, St, Req, In, Out, Err>
Source§impl<F, S, St, Req, In, Out, Err> Middleware<S, St> for FnMiddleware<F, S, St, Req, In, Out, Err>
impl<F, S, St, Req, In, Out, Err> Middleware<S, St> for FnMiddleware<F, S, St, Req, In, Out, Err>
Source§fn create(
&self,
_: &St,
service: S,
) -> <FnMiddleware<F, S, St, Req, In, Out, Err> as Middleware<S, St>>::Service
fn create( &self, _: &St, service: S, ) -> <FnMiddleware<F, S, St, Req, In, Out, Err> as Middleware<S, St>>::Service
Wraps
service using the supplied construction state. Read moreSource§fn apply_to<Sf, Req>(
self,
factory: Sf,
) -> ServiceChainFactory<ApplyMiddleware<Self, Sf>, St, Req>
fn apply_to<Sf, Req>( self, factory: Sf, ) -> ServiceChainFactory<ApplyMiddleware<Self, Sf>, St, Req>
Creates a service factory that instantiates a service and applies
the current middleware to it. Read more
Auto Trait Implementations§
impl<F, S, St, Req, In, Out, Err> Freeze for FnMiddleware<F, S, St, Req, In, Out, Err>where
F: Freeze,
impl<F, S, St, Req, In, Out, Err> RefUnwindSafe for FnMiddleware<F, S, St, Req, In, Out, Err>where
F: RefUnwindSafe,
impl<F, S, St, Req, In, Out, Err> Send for FnMiddleware<F, S, St, Req, In, Out, Err>where
F: Send,
impl<F, S, St, Req, In, Out, Err> Sync for FnMiddleware<F, S, St, Req, In, Out, Err>where
F: Sync,
impl<F, S, St, Req, In, Out, Err> Unpin for FnMiddleware<F, S, St, Req, In, Out, Err>where
F: Unpin,
impl<F, S, St, Req, In, Out, Err> UnsafeUnpin for FnMiddleware<F, S, St, Req, In, Out, Err>where
F: UnsafeUnpin,
impl<F, S, St, Req, In, Out, Err> UnwindSafe for FnMiddleware<F, S, St, Req, In, Out, Err>where
F: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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