Init
This commit is contained in:
21
src/state/live_keys.rs
Normal file
21
src/state/live_keys.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user