#[non_exhaustive]pub struct Modifiers {
pub alt: bool,
pub shift: bool,
pub ctrl: bool,
pub super_key: bool,
}Expand description
Modifier key state.
Bindings treat Ctrl and Super as one key, so a binding on Ctrl also fires on
Cmd on macOS (see for_bindings). Text fields and
shortcut handlers that follow platform conventions read ctrl and super_key
apart, or command.
Build one from a constant and the with_* methods, or with an adapter
(modifiers_from_egui); struct literals are not available outside this crate.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.alt: boolAlt/Option key held.
shift: boolShift key held.
ctrl: boolCtrl key held.
super_key: boolSuper key held: Cmd on macOS, the Windows key on Windows.
Implementations§
Source§impl Modifiers
impl Modifiers
Sourcepub const CTRL_SHIFT: Modifiers
pub const CTRL_SHIFT: Modifiers
Ctrl + Shift held.
Sourcepub const fn with_shift(self, held: bool) -> Modifiers
pub const fn with_shift(self, held: bool) -> Modifiers
This state with Shift set to held.
Sourcepub const fn with_super(self, held: bool) -> Modifiers
pub const fn with_super(self, held: bool) -> Modifiers
This state with Super set to held.
Sourcepub const fn command(self) -> bool
pub const fn command(self) -> bool
Whether the platform’s shortcut modifier is held: Cmd (super_key) on
macOS, Ctrl elsewhere. Decided by the target this is compiled for, so a
web build reads Ctrl on a Mac too.
Sourcepub const fn for_bindings(self) -> Modifiers
pub const fn for_bindings(self) -> Modifiers
This state as bindings compare it: Super folded into Ctrl, so a binding on Ctrl fires on either key.