pub struct Context { /* private fields */ }Available on Windows only.
Expand description
Context handle provided to APC tasks.
Implementations§
Source§impl Context
impl Context
Sourcepub async fn cancel_guard<T, F>(&mut self, f: F) -> Result<T, Canceled>where
F: AsyncFnOnce(&mut Context) -> T,
pub async fn cancel_guard<T, F>(&mut self, f: F) -> Result<T, Canceled>where
F: AsyncFnOnce(&mut Context) -> T,
Runs f and awaits its future, converting a cancellation request for this task into
Err(Canceled), with f’s future dropped instead of the task future. The surrounding task
can run async cleanup before finishing.
Only one cancel_guard may be active for a task at a time — calling this re-entrantly
panics.
Sourcepub fn submit<T, F>(&self, f: F) -> Task<T> ⓘ
pub fn submit<T, F>(&self, f: F) -> Task<T> ⓘ
Submits f to the reactor thread as a new task and returns a
future for its result.
Because APCs are queued in a FIFO manner, self-submitting and awaiting a task can be used to guarantee that all previously pending APCs, including those generated by Win32 APIs, have run.
Auto Trait Implementations§
impl Freeze for Context
impl RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnsafeUnpin for Context
impl UnwindSafe for Context
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