expression
Choose a missed-tick policy
When processing falls behind, Burst tries to catch up, Delay shifts subsequent scheduling relative to delayed ticks, and Skip retains the schedule while skipping missed slots. Choice depends on whether every scheduled operation is meaningful. This example verifies configuration only. Tokio is an external dependency; see the proposed Cargo manifest. Expected stdout (not executed): true true Common mistake: Using catch-up bursts for expensive work without considering load.
Formal Syntax & Structure
rust syntaxrust
interval.set_missed_tick_behavior(MissedTickBehavior::Skip)Working Example
Example Snippetrust
#[tokio::main(flavor = "current_thread", start_paused = true)]async fn main() { use tokio::time::{interval, Duration, MissedTickBehavior}; let mut ticks = interval(Duration::from_secs(1)); println!("{}", ticks.missed_tick_behavior() == MissedTickBehavior::Burst); ticks.set_missed_tick_behavior(MissedTickBehavior::Skip); println!("{}", ticks.missed_tick_behavior() == MissedTickBehavior::Skip);}