zng_app::timer

Type Alias DeadlineVar

source
pub type DeadlineVar = ReadOnlyArcVar<Deadline>;
Expand description

A deadline timer.

This is a read-only variable of type Deadline, it will update once when the timer elapses.

Drop all clones of this variable to cancel the timer.

let deadline: DeadlineVar = TIMERS.deadline(20.secs());

text = deadline.map(|d| if d.has_elapsed() { "20 seconds have passed" } else { "..." });

In the example above the variable is mapped to a text, there are many other things you can do with variables, including .await for the update in UI bound async tasks. See Var<T> for details.

Aliased Typeยง

struct DeadlineVar(/* private fields */);