pub struct KeyQueue { /* private fields */ }Expand description
Key presses in emulated time: active keys are down in the machine;
pending presses (or letters, expanded when their turn comes) wait for
a fast-typed predecessor to be released first.
Implementations§
Source§impl KeyQueue
impl KeyQueue
Sourcepub fn has_key(&self, name: &str) -> bool
pub fn has_key(&self, name: &str) -> bool
Whether the model has a key called name (its drawn layout).
Sourcepub fn busy(&self) -> bool
pub fn busy(&self) -> bool
Keys are down or presses are queued: the run must keep its slices short and pump.
Sourcepub fn held(&self) -> bool
pub fn held(&self) -> bool
A key the user pressed is down and not yet released: its hold must run at 1x, or a tap at a higher speed reads as a long hold (the 42S shows NULL after about a second).
Sourcepub fn press(&mut self, name: &str) -> bool
pub fn press(&mut self, name: &str) -> bool
Queue a press of name (held until KeyQueue::release); false
if the model has no such key.
Sourcepub fn press_shifted(&mut self, name: &str, shift: &str) -> bool
pub fn press_shifted(&mut self, name: &str, shift: &str) -> bool
Queue a press of name held until KeyQueue::release, after a
tap of shift key shift unless that shift is on when the press’s
turn comes: decided then, not now, so a shift still queued or one
a queued key will use up counts. False if the model has no such key
or shift is not one of its shift keys.
Sourcepub fn type_letter(&mut self, ch: char) -> bool
pub fn type_letter(&mut self, ch: char) -> bool
Queue ch typed through the calculator’s alpha mode; false if the
model has no key for it.
Sourcepub fn type_keys(&mut self, names: &[&str])
pub fn type_keys(&mut self, names: &[&str])
Queue full presses of names, one after the other (unknown names
are skipped).
Sourcepub fn release(&mut self, name: &str)
pub fn release(&mut self, name: &str)
Release the newest press of name that the user still holds.
Sourcepub fn release_held(&mut self)
pub fn release_held(&mut self)
Release every held key once it has been down long enough (the window lost the focus).
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Drop the queue and forget every key; the machine’s keys stay as
they are (Emulator::release_keys releases both).
Sourcepub fn presses_started(&self) -> u64
pub fn presses_started(&self) -> u64
Presses the machine took since the queue was made (each key of a typed letter counts, alpha too).
Sourcepub fn take_errors(&mut self) -> Vec<Error>
pub fn take_errors(&mut self) -> Vec<Error>
Errors collected since the last call.