Macro stakker::timer_max

source ·
macro_rules! timer_max {
    ( $var:expr, $inst:expr, $($x:tt)+ ) => { ... };
}
Expand description

Create or update a “Max” timer

A “Max” timer expires at the latest (greatest) expiry time provided. See the MaxTimerKey documentation for the characteristics of this timer. Modifies a MaxTimerKey variable or structure member provided by the caller, which should be initialised with MaxTimerKey::default(). If the timer key currently in the variable is invalid or expired, then a new timer is created using the call-args following, and the key stored in the variable. Otherwise the timer contained in the variable is updated with the provided expiry time, and the call-args are ignored. If necessary, the timer may be deleted using Core::timer_max_del.

The syntax of the calls is identical to lazy!, but with a variable reference and Instant argument first.

let mut var = MaxTimerKey::default();
  :::
timer_max!(&mut var, instant, ...args-as-for-lazy-macro...);

Implemented using Core::timer_max_upd, Core::timer_max_add, Actor::apply and Actor::apply_prep.