Function spawn_periodic_task

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

周期タスクを生成する。

wakeup_list: 起動時刻。以下を満たさないと panic する。

  • second 以下が 0 である。(分単位)
  • 昇順ソート済みである。

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

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