wheel_timer2/behave.rs
1use std::time::Duration;
2
3/// Behavior after task completion
4#[derive(Debug, Copy, Clone)]
5pub enum Behave {
6 /// cancel the task, which is the default behavior.
7 Cancel,
8 /// change the time interval and continue the task.
9 Change(Duration),
10 /// repeat the task.
11 Repeat,
12}
13
14impl From<()> for Behave {
15 fn from(_: ()) -> Self {
16 Behave::Cancel
17 }
18}
19
20impl From<Duration> for Behave {
21 fn from(dur: Duration) -> Self {
22 Behave::Change(dur)
23 }
24}