Skip to main content

with_worker

Function with_worker 

Source
pub fn with_worker<R, W>(work: W) -> impl Future<Output = R>
where R: Send + 'static, W: FnOnce() -> R + Send + 'static,
Expand description

Runs work on a worker thread and resolves with its result on the UI thread. Compose’s withContext(Dispatchers.IO): the way domain work leaves the UI thread.

In a browser, which has no threads here, work runs where the future is first polled.