pub struct BlockingWork { /* private fields */ }Expand description
Embedders must finish draining before releasing execution resources. Dropping a waiter leaves its actual blocking worker registered here.
Implementations§
Source§impl BlockingWork
impl BlockingWork
Sourcepub async fn spawn<T: Send + 'static>(
&mut self,
work: impl FnOnce() -> T + Send + 'static,
) -> Result<T, BlockingWorkError>
pub async fn spawn<T: Send + 'static>( &mut self, work: impl FnOnce() -> T + Send + 'static, ) -> Result<T, BlockingWorkError>
Run a synchronous closure on an owned native thread and await its result. At most 512 such threads are admitted across executions, independently of the Tokio runtime’s blocking-pool configuration. Cancellation leaves the join registered until another finish call drains it.
Sourcepub async fn finish(&mut self) -> Result<(), BlockingWorkDrainError>
pub async fn finish(&mut self) -> Result<(), BlockingWorkDrainError>
Drain all owned work, even when one worker fails. Cancelling this future retains unfinished joins and failures already observed for a later call.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for BlockingWork
impl !UnwindSafe for BlockingWork
impl Freeze for BlockingWork
impl Send for BlockingWork
impl Sync for BlockingWork
impl Unpin for BlockingWork
impl UnsafeUnpin for BlockingWork
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