pub struct RequestCtx { /* private fields */ }Expand description
Per-request context. Retains the full route handle and correlation id, provides interim stream emission, and exposes a cancellation signal.
Implementations§
Source§impl RequestCtx
impl RequestCtx
Sourcepub fn route_handle(&self) -> RouteHandle
pub fn route_handle(&self) -> RouteHandle
Full route handle retained from ingress.
Sourcepub async fn emit(&self, body: Vec<u8>) -> Result<(), SubcModuleError>
pub async fn emit(&self, body: Vec<u8>) -> Result<(), SubcModuleError>
Emit an interim StreamData frame on this request’s (channel, corr). Once
the request is cancelled or its route is gone, late emits are dropped.
Sourcepub async fn emit_with_admission(
&self,
body: Vec<u8>,
admission_class: Option<AdmissionClass>,
) -> Result<(), SubcModuleError>
pub async fn emit_with_admission( &self, body: Vec<u8>, admission_class: Option<AdmissionClass>, ) -> Result<(), SubcModuleError>
Emit StreamData with an explicit admission class. None means NORMAL.
Sourcepub fn cancelled(&self) -> WaitForCancellationFuture<'_> ⓘ
pub fn cancelled(&self) -> WaitForCancellationFuture<'_> ⓘ
Completes when the other side sends Cancel for this request or the route is torn down.
Sourcepub fn cancellation_token(&self) -> CancellationToken
pub fn cancellation_token(&self) -> CancellationToken
Return a cloneable cancellation token for code that prefers token polling.
Trait Implementations§
Source§impl Clone for RequestCtx
impl Clone for RequestCtx
Source§fn clone(&self) -> RequestCtx
fn clone(&self) -> RequestCtx
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 moreAuto Trait Implementations§
impl Freeze for RequestCtx
impl RefUnwindSafe for RequestCtx
impl Send for RequestCtx
impl Sync for RequestCtx
impl Unpin for RequestCtx
impl UnsafeUnpin for RequestCtx
impl UnwindSafe for RequestCtx
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