Skip to main content

withBlocking

Function withBlocking 

Source
pub async fn withBlocking<T, F>(work: F) -> Result<T, BlockingError>
where T: Send + 'static, F: FnOnce() -> T + Send + 'static,
Expand description

Runs synchronous work on the shared bounded executor when first polled.

A full queue suspends this future until capacity is available, keeping the UI thread free. Shutdown and unwinding panics are reported as errors. Dropping the future releases its captures and cancels work not yet started. Running closures cannot be interrupted. Bound concurrent callers to bound the memory retained by their suspended futures. On Web this returns Unsupported without running the closure.