pub struct RequestGuard { /* private fields */ }Expand description
A guard that automatically completes the request when dropped.
Use this to ensure requests are properly cleaned up even on early returns.
Implementations§
Source§impl RequestGuard
impl RequestGuard
Sourcepub async fn new(
manager: CancellationManager,
session_id: SessionId,
request_id: RequestId,
) -> Self
pub async fn new( manager: CancellationManager, session_id: SessionId, request_id: RequestId, ) -> Self
Create a new request guard.
Sourcepub fn token(&self) -> &CancellationToken
pub fn token(&self) -> &CancellationToken
Get the cancellation token.
Sourcepub fn is_cancelled(&self) -> bool
pub fn is_cancelled(&self) -> bool
Check if the request has been cancelled.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for RequestGuard
impl !RefUnwindSafe for RequestGuard
impl Send for RequestGuard
impl Sync for RequestGuard
impl Unpin for RequestGuard
impl UnsafeUnpin for RequestGuard
impl !UnwindSafe for RequestGuard
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