Function kumo_server_runtime::rt_spawn
source ยท pub async fn rt_spawn<F: FnOnce() -> Result<FUT> + Send + 'static, FUT>(
name: String,
func: F,
) -> Result<JoinHandle<FUT::Output>>
Expand description
Schedule func to run in the runtime pool. func must return a future; that future will be spawned into the thread-local executor. This function will return the result of the spawn attempt, but will not wait for the future it spawns to complete.
This function is useful for getting into a localset environment where !Send futures can be scheduled when you are not already in such an environment.
If you are already in a !Send future, then using spawn_local below has less overhead.