pub struct ReadyBindingMiddleware;Expand description
Middleware that wraps each service in a fresh ReadyBinding.
Each created service gets an independent, notification-invalidated readiness
cache. Successful readiness survives calls and changes to sibling services.
The inner service must subscribe to readiness-change notifications in
Service::bind, as described by ReadyBinding.
Construction does not retain state, bind the service, or check readiness. The enclosing pipeline or service must bind the returned wrapper before use.
§Example
use ntex_service::{ReadyBindingMiddleware, factory, fn_service};
let factory = factory(fn_service(async |req: u32| Ok::<_, ()>(req + 1)))
.apply(ReadyBindingMiddleware);
let pipeline = factory.pipeline(()).await.unwrap();
assert_eq!(pipeline.call(1).await, Ok(2));Trait Implementations§
Source§impl Clone for ReadyBindingMiddleware
impl Clone for ReadyBindingMiddleware
Source§fn clone(&self) -> ReadyBindingMiddleware
fn clone(&self) -> ReadyBindingMiddleware
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 moreimpl Copy for ReadyBindingMiddleware
Source§impl Debug for ReadyBindingMiddleware
impl Debug for ReadyBindingMiddleware
Source§impl Default for ReadyBindingMiddleware
impl Default for ReadyBindingMiddleware
Source§fn default() -> ReadyBindingMiddleware
fn default() -> ReadyBindingMiddleware
Returns the “default value” for a type. Read more
impl Eq for ReadyBindingMiddleware
Source§impl<S, St> Middleware<S, St> for ReadyBindingMiddleware
impl<S, St> Middleware<S, St> for ReadyBindingMiddleware
Source§type Service = ReadyBinding<S>
type Service = ReadyBinding<S>
Wrapper returned by
Self::create. Read moreSource§fn create(
&self,
_: &St,
service: S,
) -> <ReadyBindingMiddleware as Middleware<S, St>>::Service
fn create( &self, _: &St, service: S, ) -> <ReadyBindingMiddleware 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
Source§impl PartialEq for ReadyBindingMiddleware
impl PartialEq for ReadyBindingMiddleware
impl StructuralPartialEq for ReadyBindingMiddleware
Auto Trait Implementations§
impl Freeze for ReadyBindingMiddleware
impl RefUnwindSafe for ReadyBindingMiddleware
impl Send for ReadyBindingMiddleware
impl Sync for ReadyBindingMiddleware
impl Unpin for ReadyBindingMiddleware
impl UnsafeUnpin for ReadyBindingMiddleware
impl UnwindSafe for ReadyBindingMiddleware
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.