pub struct Ctx<'a, Svc: ?Sized, St = ()> { /* private fields */ }Expand description
Context provided to Service lifecycle methods.
A context gives a service access to pipeline state and coordinates calls to inner services with the pipeline’s readiness and shutdown machinery.
Implementations§
Source§impl<'a, Svc, St> Ctx<'a, Svc, St>
impl<'a, Svc, St> Ctx<'a, Svc, St>
Sourcepub async fn ready<S, Req>(&self, svc: &'a S) -> Result<(), S::Error>where
S: Service<St, Req>,
pub async fn ready<S, Req>(&self, svc: &'a S) -> Result<(), S::Error>where
S: Service<St, Req>,
Waits until svc is ready to process a request.
Sourcepub async fn call<S, Req>(
&self,
svc: &'a S,
req: Req,
) -> Result<S::Res, S::Error>where
S: Service<St, Req>,
pub async fn call<S, Req>(
&self,
svc: &'a S,
req: Req,
) -> Result<S::Res, S::Error>where
S: Service<St, Req>,
Waits for svc to become ready, then calls it.
Sourcepub async fn call_nowait<S, Req>(
&self,
svc: &'a S,
req: Req,
) -> Result<S::Res, S::Error>where
S: Service<St, Req>,
pub async fn call_nowait<S, Req>(
&self,
svc: &'a S,
req: Req,
) -> Result<S::Res, S::Error>where
S: Service<St, Req>,
Calls svc without checking readiness.
The caller must ensure that svc is ready.
Sourcepub async fn poll_fn<F, R>(&'a self, f: F) -> R
pub async fn poll_fn<F, R>(&'a self, f: F) -> R
Polls a closure until completion using the dispatcher’s task Context.
Trait Implementations§
impl<S, St> Copy for Ctx<'_, S, St>
Auto Trait Implementations§
impl<'a, Svc, St = ()> !RefUnwindSafe for Ctx<'a, Svc, St>
impl<'a, Svc, St = ()> !Send for Ctx<'a, Svc, St>
impl<'a, Svc, St = ()> !Sync for Ctx<'a, Svc, St>
impl<'a, Svc, St = ()> !UnwindSafe for Ctx<'a, Svc, St>
impl<'a, Svc, St> Freeze for Ctx<'a, Svc, St>
impl<'a, Svc, St> Unpin for Ctx<'a, Svc, St>
impl<'a, Svc, St> UnsafeUnpin for Ctx<'a, Svc, St>
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