Skip to main content

ApplyCtx

Struct ApplyCtx 

Source
pub struct ApplyCtx<'a, S, St, Req> { /* private fields */ }
Expand description

State and inner-service access for apply_fn and apply_fn_factory middleware.

Self::st borrows the current pipeline state, and Self::call invokes the inner service with that state. The context also implements ServiceCaller, with the same call behavior.

Calls forward directly to the inner service. Wrap it with crate::ready() to check its independent readiness on each call, including after middleware awaits or makes another call. The context borrows both the state and the inner service for the middleware invocation.

Implementations§

Source§

impl<S, St, Req> ApplyCtx<'_, S, St, Req>
where S: Service<St, Req>,

Source

pub fn st(&self) -> &St

Returns the pipeline state.

Inner calls made through this context receive the same state reference.

Source

pub fn call( &self, req: Req, ) -> impl Future<Output = Result<<S as Service<St, Req>>::Res, <S as Service<St, Req>>::Error>>

Calls the inner service, preserving any explicit readiness wrapper.

This does not independently check readiness for a raw inner service. An inner crate::ready() wrapper still checks its own readiness cache.

Returns the inner response and error types without applying the outer middleware’s conversions.

Trait Implementations§

Source§

impl<'a, S, St, Req> Debug for ApplyCtx<'a, S, St, Req>
where S: Debug, St: Debug, Req: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl<S, St, Req> ServiceCaller<Req, <S as Service<St, Req>>::Res, <S as Service<St, Req>>::Error> for ApplyCtx<'_, S, St, Req>
where S: Service<St, Req>,

Source§

fn call_service( &self, req: Req, ) -> impl Future<Output = Result<<S as Service<St, Req>>::Res, <S as Service<St, Req>>::Error>>

Waits for readiness, then calls the service.

Auto Trait Implementations§

§

impl<'a, S, St, Req> !RefUnwindSafe for ApplyCtx<'a, S, St, Req>

§

impl<'a, S, St, Req> !Send for ApplyCtx<'a, S, St, Req>

§

impl<'a, S, St, Req> !Sync for ApplyCtx<'a, S, St, Req>

§

impl<'a, S, St, Req> !UnwindSafe for ApplyCtx<'a, S, St, Req>

§

impl<'a, S, St, Req> Freeze for ApplyCtx<'a, S, St, Req>

§

impl<'a, S, St, Req> Unpin for ApplyCtx<'a, S, St, Req>
where Req: Unpin,

§

impl<'a, S, St, Req> UnsafeUnpin for ApplyCtx<'a, S, St, Req>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V