pub struct KeyMods {
pub shift: bool,
pub ctrl: bool,
pub alt: bool,
pub super_key: bool,
}Expand description
Physical modifier state. Unlike Mods — which abstracts platform
conventions for the input widget (word, doc) — nothing here is
normalized: an app binding Ctrl-w needs to know it was Control and not
Command.
Fields§
§shift: bool§ctrl: bool§alt: bool§super_key: boolWindows key / Command / Super.
Implementations§
Source§impl KeyMods
impl KeyMods
Sourcepub const SHIFT: u32
pub const SHIFT: u32
Bit 0 Shift, 1 Ctrl, 2 Alt, 3 Super — the order the fields are
declared in, and the C header’s KUI_KMOD_* (pinned there). What
a wire that carries the state as one integer spells it as: the
conformance corpus’s modifiers step, the C input door.
pub const CTRL: u32
pub const ALT: u32
pub const SUPER: u32
Sourcepub const NONE: KeyMods
pub const NONE: KeyMods
No modifier held: what the with_* steps start from —
KeyMods::NONE.with_shift().with_ctrl().
pub const fn with_shift(self) -> Self
pub const fn with_ctrl(self) -> Self
pub const fn with_alt(self) -> Self
pub const fn with_super(self) -> Self
Sourcepub const fn with_primary(self) -> Self
pub const fn with_primary(self) -> Self
The platform primary shortcut modifier held: Command on macOS,
Control elsewhere — the one Self::primary reads.
pub fn from_bits(bits: u32) -> Self
pub fn bits(self) -> u32
pub fn any(self) -> bool
Sourcepub fn parse(names: &str) -> Self
pub fn parse(names: &str) -> Self
From the schema’s spelling (the scrollMods row): names separated
by spaces or commas — "ctrl", "ctrl super", "shift, alt". A
word that is none of the four is skipped, so a string of none of
them names nothing.
Sourcepub fn to_fields(self) -> Value
pub fn to_fields(self) -> Value
{shift=, ctrl=, alt=, super=}: the state as an event carries it
under a field of its own (a scroll event’s mods).
Trait Implementations§
impl Copy for KeyMods
impl Eq for KeyMods
impl StructuralPartialEq for KeyMods
Auto Trait Implementations§
impl Freeze for KeyMods
impl RefUnwindSafe for KeyMods
impl Send for KeyMods
impl Sync for KeyMods
impl Unpin for KeyMods
impl UnsafeUnpin for KeyMods
impl UnwindSafe for KeyMods
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.