[−][src]Function safina_executor::spawn
pub fn spawn(fut: impl Future<Output = ()> + Send + 'static)
Creates a new task to execute fut
and schedules it for immediate execution.
Panics if the caller is not running on an Executor
.
Returns immediately.
Uses
std::boxed::Box::pin
to make the future
Unpin
.
You can use spawn_unpin
to avoid this allocation.
Example:
let executor = safina_executor::Executor::default(); executor.spawn(async move { safina_executor::spawn(async move { an_async_fn().await.unwrap(); }); });