-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed as not planned
Labels
A-tokioArea: The main tokio crateArea: The main tokio crateC-feature-requestCategory: A feature request.Category: A feature request.M-taskModule: tokio/taskModule: tokio/task
Description
I would love to be able to spawn non-'static
tasks into the Tokio runtime, like so:
let local_data = LocalData::new();
let result = runtime.block_on_scoped(|scope| {
let future_result = scope.spawn(async {
local_data.result()
});
async {
future_result.await.unwrap()
}
});
This type of thing exists in Crossbeam: https://docs.rs/crossbeam/0.8.0/crossbeam/fn.scope.html
Someone wrote this for an older version of Tokio: https://docs.rs/tokio-scoped/0.1.0/tokio_scoped
andreytkachenko, Kixunil, demurgos, MaxVerevkin, bonsairobo and 25 more
Metadata
Metadata
Assignees
Labels
A-tokioArea: The main tokio crateArea: The main tokio crateC-feature-requestCategory: A feature request.Category: A feature request.M-taskModule: tokio/taskModule: tokio/task