pub struct LockStateKeys { /* private fields */ }
Expand description
The lock state of the lock keys.
Consult the state diagram below for the intended state transition. The state encoding is given in [State].
ⓘ
Key """""""\_________/"""""""""""\_________/""""
State -------< S1 >< S2 >< S3 >----
Any other state is not explicitly accounted for: the state of “the lock is not active” is encoded by not having a record of the key state. This allows us to implement the state machine for an arbitrary number of lock keys.
Implementations§
Source§impl LockStateKeys
impl LockStateKeys
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new LockStateKeys initializes with the default state (no modifiers are actuated).
Sourcepub fn with(self, value: LockState) -> Self
pub fn with(self, value: LockState) -> Self
Unconditionally adds the given lock state as actuated.
Returns Self
for chaining.
Sourcepub fn with_if(self, value: LockState, set: bool) -> Self
pub fn with_if(self, value: LockState, set: bool) -> Self
Adds value
into the modifier state as actuated, if set
is true.
Otherwise makes no changes to LockStateKeys.
Returns Self
for chaining.
Sourcepub fn update(&mut self, event: KeyEventType, key: Key)
pub fn update(&mut self, event: KeyEventType, key: Key)
Update the modifier tracker state with this event.
Trait Implementations§
Source§impl Debug for LockStateKeys
impl Debug for LockStateKeys
Source§impl Default for LockStateKeys
impl Default for LockStateKeys
Source§impl LockStateChecker for LockStateKeys
impl LockStateChecker for LockStateKeys
Auto Trait Implementations§
impl Freeze for LockStateKeys
impl RefUnwindSafe for LockStateKeys
impl Send for LockStateKeys
impl Sync for LockStateKeys
impl Unpin for LockStateKeys
impl UnwindSafe for LockStateKeys
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more