Enum ModifiersKeyState
pub enum ModifiersKeyState {
Pressed,
Unknown,
}Expand description
The logical state of the particular modifiers key.
NOTE: while the modifier can only be in a binary active/inactive state, it might be helpful to note the context re. how its state changes by physical key events.
↓ / ↑ denote physical press/release1:
| Type | Activated | Deactivated | Comment |
|---|---|---|---|
| Regular | ↓ | ↑ | Active while being held |
| Sticky | ↓ | ↓ unless lock is enabled↓/↑2 non-sticky key | Temporarily “stuck”; other Sticky keys have no effect |
| Sticky Locked | ↓ if Sticky | ↓ | Similar to Toggle, but deactivating ↓ turns on Regular effect |
| Toggle | ↓ | ↓ | ↑ from the activating ↓ has no effect |
Sticky effect avoids the need to press and hold multiple modifiers for a single shortcut and
is usually a platform-wide option that affects modifiers commonly used in shortcuts:
Shift, Control, Alt, Meta.
Toggle type is typically a property of a modifier, for example, Caps Lock.
These active states are not differentiated here.
Variants§
Pressed
The particular modifier is active or logically, but not necessarily physically, pressed.
Unknown
The state of the key is unknown.
Can include cases when the key is active or logically pressed, for example, when a sticky
Shift is active, the OS might not preserve information that it was activated by
RightShift, so the state of ModifiersKeys::RSHIFT will be unknown while the state
of ModifiersState::SHIFT will be active.
Trait Implementations§
§impl Clone for ModifiersKeyState
impl Clone for ModifiersKeyState
§fn clone(&self) -> ModifiersKeyState
fn clone(&self) -> ModifiersKeyState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl Debug for ModifiersKeyState
impl Debug for ModifiersKeyState
§impl Default for ModifiersKeyState
impl Default for ModifiersKeyState
§fn default() -> ModifiersKeyState
fn default() -> ModifiersKeyState
§impl Hash for ModifiersKeyState
impl Hash for ModifiersKeyState
§impl Ord for ModifiersKeyState
impl Ord for ModifiersKeyState
§fn cmp(&self, other: &ModifiersKeyState) -> Ordering
fn cmp(&self, other: &ModifiersKeyState) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
§impl PartialEq for ModifiersKeyState
impl PartialEq for ModifiersKeyState
§impl PartialOrd for ModifiersKeyState
impl PartialOrd for ModifiersKeyState
impl Copy for ModifiersKeyState
impl Eq for ModifiersKeyState
impl StructuralPartialEq for ModifiersKeyState
Auto Trait Implementations§
impl Freeze for ModifiersKeyState
impl RefUnwindSafe for ModifiersKeyState
impl Send for ModifiersKeyState
impl Sync for ModifiersKeyState
impl Unpin for ModifiersKeyState
impl UnwindSafe for ModifiersKeyState
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.