generated from GarandPLG/rust-flake-template
- Document new Rust formatting standards in AGENTS, CODE_MAP, and PROGRESS. - Add rustfmt.toml with style 2024, 2‑space indents, 100‑char width, LF endings. - Apply consistent 2‑space indentation and ordering across source files. - Minor clean‑up of imports and whitespace to match the new style.
22 lines
408 B
Rust
22 lines
408 B
Rust
use std::{
|
|
sync::mpsc::Sender,
|
|
thread,
|
|
time::{Duration, Instant},
|
|
};
|
|
|
|
pub const TICK_MS: u8 = 33;
|
|
|
|
pub fn handle_tick_event(tx: Sender<()>) {
|
|
let interval: Duration = Duration::from_millis(TICK_MS as u64);
|
|
loop {
|
|
if tx.send(()).is_err() {
|
|
break;
|
|
}
|
|
|
|
let elapsed: Duration = Instant::now().elapsed();
|
|
if interval > elapsed {
|
|
thread::sleep(interval - elapsed);
|
|
}
|
|
}
|
|
}
|