pub struct KeyboardShortcut {
pub modifiers: Modifiers,
pub logical_key: Key,
}Expand description
A keyboard shortcut, e.g. Ctrl+Alt+W.
Can be used with crate::InputState::consume_shortcut
and crate::Context::format_shortcut.
Fields§
§modifiers: Modifiers§logical_key: KeyImplementations§
Source§impl KeyboardShortcut
impl KeyboardShortcut
pub const fn new(modifiers: Modifiers, logical_key: Key) -> KeyboardShortcut
pub fn format(&self, names: &ModifierNames<'_>, is_mac: bool) -> String
Trait Implementations§
Source§impl Clone for KeyboardShortcut
impl Clone for KeyboardShortcut
Source§fn clone(&self) -> KeyboardShortcut
fn clone(&self) -> KeyboardShortcut
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KeyboardShortcut
impl Debug for KeyboardShortcut
Source§impl<'de> Deserialize<'de> for KeyboardShortcut
impl<'de> Deserialize<'de> for KeyboardShortcut
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<KeyboardShortcut, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<KeyboardShortcut, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<DynamicShortcut> for KeyboardShortcut
impl From<DynamicShortcut> for KeyboardShortcut
Source§fn from(shortcut: DynamicShortcut) -> Self
fn from(shortcut: DynamicShortcut) -> Self
Converts to this type from the input type.
Source§impl From<KeyboardShortcut> for DynamicShortcut
impl From<KeyboardShortcut> for DynamicShortcut
Source§fn from(shortcut: KeyboardShortcut) -> Self
fn from(shortcut: KeyboardShortcut) -> Self
Converts to this type from the input type.
Source§impl Hash for KeyboardShortcut
impl Hash for KeyboardShortcut
Source§impl InputBinding for KeyboardShortcut
impl InputBinding for KeyboardShortcut
Source§fn matches(&self, ctx: &Context) -> bool
fn matches(&self, ctx: &Context) -> bool
Check if this binding was triggered (does not consume the input).
Source§fn consume(&self, ctx: &Context) -> bool
fn consume(&self, ctx: &Context) -> bool
Consume the input and return whether it was triggered. Read more
Source§fn as_keyboard_shortcut(&self) -> Option<KeyboardShortcut>
fn as_keyboard_shortcut(&self) -> Option<KeyboardShortcut>
Convert to KeyboardShortcut if possible.
Source§impl PartialEq for KeyboardShortcut
impl PartialEq for KeyboardShortcut
Source§impl Serialize for KeyboardShortcut
impl Serialize for KeyboardShortcut
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl Copy for KeyboardShortcut
impl Eq for KeyboardShortcut
impl StructuralPartialEq for KeyboardShortcut
Auto Trait Implementations§
impl Freeze for KeyboardShortcut
impl RefUnwindSafe for KeyboardShortcut
impl Send for KeyboardShortcut
impl Sync for KeyboardShortcut
impl Unpin for KeyboardShortcut
impl UnsafeUnpin for KeyboardShortcut
impl UnwindSafe for KeyboardShortcut
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