pub struct KeyStroke {
pub key: ShortcutKey,
pub ctrl: bool,
pub shift: bool,
pub alt: bool,
pub meta: bool,
}Expand description
A key plus its modifiers — both the pattern a shortcut is bound to and the description of what was actually pressed. One type, because they are compared to each other and a second one would only be the first with the fields renamed.
Fields§
§key: ShortcutKeyThe key itself.
ctrl: boolControl (or Command on macOS, where the shell maps it here).
shift: boolShift.
alt: boolAlt / Option.
meta: boolThe platform’s “logo” key, when it is not already folded into ctrl.
Implementations§
Source§impl KeyStroke
impl KeyStroke
Sourcepub const fn new(key: ShortcutKey) -> Self
pub const fn new(key: ShortcutKey) -> Self
A bare key, no modifiers.
Sourcepub const fn is_command(&self) -> bool
pub const fn is_command(&self) -> bool
Does this stroke carry a modifier that makes it a command rather than typing?
Shift alone does not: Shift+A is a capital A.
Trait Implementations§
impl Copy for KeyStroke
impl Eq for KeyStroke
impl StructuralPartialEq for KeyStroke
Auto Trait Implementations§
impl Freeze for KeyStroke
impl RefUnwindSafe for KeyStroke
impl Send for KeyStroke
impl Sync for KeyStroke
impl Unpin for KeyStroke
impl UnsafeUnpin for KeyStroke
impl UnwindSafe for KeyStroke
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