Skip to main content

spawn

Function spawn 

Source
pub fn spawn<F>(fut: F) -> JoinHandle<F::Output> ⓘ
where F: Future + 'static,
Expand description

Spawns a future on the current native runtime and returns its join handle.

The future and its output need not be Send. The current system’s TaskCallbacks wrap the task. Dropping the handle detaches it unless cancel_on_drop is enabled. Completion is not guaranteed if the runtime shuts down.

§Panics

Panics if no native runtime is active on the current thread.