Trait async_main::Spawn
source · pub trait Spawn: Clone {
// Required method
fn spawn_local(&self, f: impl Future<Output = ()> + 'static);
// Provided method
fn spawn(&self, f: impl Future<Output = ()> + Send + 'static) { ... }
}
Expand description
Implementation for spawning tasks on an executor.
Required Methods§
sourcefn spawn_local(&self, f: impl Future<Output = ()> + 'static)
fn spawn_local(&self, f: impl Future<Output = ()> + 'static)
Spawn a [Future
] without the Send
requirement.
This forces the executor to always run the task on the same thread that this method is called on.