Function spawn_blocking
Source pub async fn spawn_blocking<T, F>(f: F) -> Result<T, SpawnBlockingError>
Expand description
Spawn a blocking task on the thread pool.
This function spawns the given closure on a blocking thread pool and returns
a future that resolves to the result.
§Panics
Panics if called outside a runtime context.
§Examples
ⓘlet result = vibeio::spawn_blocking(|| {
42
}).await?;