Function spawn

Source
pub fn spawn<T: Send + 'static>(
    fut: impl Future<Output = T> + Send + 'static,
) -> impl Task<Output = T>
Expand description

Spawns a new task on the global executor.

This is a convenience function that spawns a task using the default global executor instance. The spawned task must be Send + 'static, allowing it to be moved between threads.

ยงGlobal Executor

The global executor is determined by feature flags:

  • With default-async-executor (default): Uses [async_executor::Executor]
  • With default-tokio: Uses [tokio::runtime::Runtime]