pub struct Shortcut {
pub key: String,
pub primary: bool,
pub shift: bool,
pub alt: bool,
pub control: bool,
}Expand description
A keyboard shortcut for a menu item. primary is the platform’s command modifier (⌘ on Apple,
Ctrl on GTK/Qt/XAML) so one declaration reads correctly everywhere. key is a single character
("s", ".") or a named key ("Return", "Delete", "Left", "F1").
Fields§
§key: String§primary: bool⌘ (Apple) / Ctrl (elsewhere). The conventional command modifier.
shift: bool§alt: bool⌥ / Alt.
control: boolLiteral Control (⌃ on Apple). Rare; prefer primary for the command modifier.
Implementations§
Source§impl Shortcut
impl Shortcut
Sourcepub fn primary(key: impl Into<String>) -> Shortcut
pub fn primary(key: impl Into<String>) -> Shortcut
primary+key (⌘S / Ctrl+S), the common case: Shortcut::primary("s").shift().
Sourcepub fn plain(key: impl Into<String>) -> Shortcut
pub fn plain(key: impl Into<String>) -> Shortcut
key with no modifiers (e.g. F1, plain Delete).
pub fn shift(self) -> Shortcut
pub fn alt(self) -> Shortcut
pub fn control(self) -> Shortcut
Trait Implementations§
impl Eq for Shortcut
impl StructuralPartialEq for Shortcut
Auto Trait Implementations§
impl Freeze for Shortcut
impl RefUnwindSafe for Shortcut
impl Send for Shortcut
impl Sync for Shortcut
impl Unpin for Shortcut
impl UnsafeUnpin for Shortcut
impl UnwindSafe for Shortcut
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more