Skip to main content

spawn_task

Function spawn_task 

Source
pub async fn spawn_task<F, Fut, T>(
    thread_mgr: SharedThreadManager,
    options: SpawnOptions,
    task_fn: F,
) -> SubtaskHandle<T>
where F: FnOnce(CancellationToken, SharedThreadManager) -> Fut + Send + 'static, Fut: Future<Output = Result<T, String>> + Send + 'static, T: Send + 'static,
Expand description

Spawn a one-shot background task.

Similar to spawn_subagent but creates a Task thread instead of SubAgent. Best for quick async work that returns a result.