pub fn spawn_local<T>(future: impl Future<Output = T> + 'static) -> Task<T>Notable traits for Task<T>impl<T> Future for Task<T>    type Output = T; where
    T: 'static, 
Expand description

Spawns a task onto the current single-threaded executor.

If called from a LocalExecutor, the task is spawned on it. Otherwise, this method panics.

Note that there is no guarantee of when the spawned task is scheduled. The current task can continue its execution or be preempted by the newly spawned task immediately. See the documentation for the top-level Task for examples.

Proxy to ExecutorProxy::spawn_local


use glommio::{LocalExecutor, Task};

let local_ex = LocalExecutor::default(); {
    let task = glommio::spawn_local(async { 1 + 2 });
    assert_eq!(task.await, 3);