Function spawn_oneshot_task

Source
pub fn spawn_oneshot_task<F, T>(ctrl: &Control, name: &str, f: F)
where F: Fn(Control) -> T + Send + Sync + 'static, T: Future<Output = Result<()>> + Send,
Expand description

1回限りのタスクを生成して実行開始する。

F: Control を引数に、T を返す関数。 T: Future<Output = anyhow::Result<()> かつスレッド間移動可能。

つまり、F は Control を引数に、anyhow::Result<()> を返す async function。