pub struct KeyCombo {
pub key: ComboKey,
pub modifiers: Modifiers,
}Expand description
A key plus the exact modifier state required to trigger it.
Build one with KeyCombo::new or the platform-flavored shorthands
KeyCombo::command, KeyCombo::alt, KeyCombo::bare.
Fields§
§key: ComboKeyThe key that must be pressed.
modifiers: ModifiersThe modifiers that must be held, compared by exact equality.
Implementations§
Source§impl KeyCombo
impl KeyCombo
Sourcepub fn new(key: ComboKey, modifiers: Modifiers) -> Self
pub fn new(key: ComboKey, modifiers: Modifiers) -> Self
Builds a combo from an explicit key and modifier state.
Sourcepub fn command(c: char) -> Self
pub fn command(c: char) -> Self
Builds a combo for c held with the platform “command” modifier
(Cmd on macOS, Ctrl elsewhere).
Sourcepub fn matches(
&self,
key: &Key,
physical: Physical,
modifiers: Modifiers,
) -> bool
pub fn matches( &self, key: &Key, physical: Physical, modifiers: Modifiers, ) -> bool
Reports whether a key press satisfies this combo.
Modifiers are compared by exact equality, not Modifiers::contains:
a combo for Cmd+A does not match a Cmd+Shift+A press. This differs
from the pointer modifier fields on Keymap, which the widget tests
with contains semantics.
ComboKey::Char resolves the physical key to its latin equivalent
via Key::to_latin so the shortcut fires regardless of keyboard
layout (e.g. a Dvorak or Cyrillic layout), then compares
case-insensitively. When to_latin cannot resolve a latin character
(the key has no established Latin-alphabet code, e.g. punctuation
outside the mapped set), this falls back to comparing the logical
Key::Character text case-insensitively.
Trait Implementations§
impl Copy for KeyCombo
impl Eq for KeyCombo
impl StructuralPartialEq for KeyCombo
Auto Trait Implementations§
impl Freeze for KeyCombo
impl RefUnwindSafe for KeyCombo
impl Send for KeyCombo
impl Sync for KeyCombo
impl Unpin for KeyCombo
impl UnsafeUnpin for KeyCombo
impl UnwindSafe for KeyCombo
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<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
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§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.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<State, Message> IntoBoot<State, Message> for State
impl<State, Message> IntoBoot<State, Message> for State
Source§fn into_boot(self) -> (State, Task<Message>)
fn into_boot(self) -> (State, Task<Message>)
Application.