Files
Cagire/src/state/live_keys.rs
2026-01-21 17:05:30 +01:00

22 lines
427 B
Rust

use std::sync::atomic::{AtomicBool, Ordering};
#[derive(Default)]
pub struct LiveKeyState {
fill: AtomicBool,
}
impl LiveKeyState {
pub fn new() -> Self {
Self::default()
}
pub fn fill(&self) -> bool {
self.fill.load(Ordering::Relaxed)
}
pub fn flip_fill(&self) {
let current = self.fill.load(Ordering::Relaxed);
self.fill.store(!current, Ordering::Relaxed);
}
}