Function uexec::spawn_local[][src]

pub fn spawn_local<R: 'static, F: Future<Output = R> + 'static>(
    future: F
) -> LocalJoinHandle<R>

Spawns a task onto the local executor.

The task does not need to be Send as it will be spawned on the same thread.

Examples


let task1 = uexec::spawn_local(async {
    1 + 2
});
let task2 = uexec::spawn_local(async {
    3 + 4
});
let task = future::zip(task1, task2);

uexec::block_on(async {
    assert_eq!(task.await, (3, 7));
});