Struct Shortcut
pub struct Shortcut { /* private fields */ }Expand description
A semantic shortcut whose display and matching use platform conventions.
Implementations§
§impl Shortcut
impl Shortcut
pub fn command(key: impl Into<String>) -> Shortcut
pub fn key(key: impl Into<String>) -> Shortcut
pub fn key(key: impl Into<String>) -> Shortcut
A key pressed on its own, without the command modifier: F3, Delete, or a single letter a view answers while it has focus.
pub fn chord<'a>(
modifiers: impl IntoIterator<Item = &'a str>,
key: &str,
) -> Shortcut
pub fn chord<'a>( modifiers: impl IntoIterator<Item = &'a str>, key: &str, ) -> Shortcut
A chord as the desktop’s shortcut table stores it: modifier names
(Super, Ctrl, Alt, Shift) and a key, spelled for display in
the active keyboard layout’s legends.
pub fn has_system(&self) -> bool
pub fn shift(self) -> Shortcut
pub fn alt(self) -> Shortcut
pub fn has_command(&self) -> bool
pub fn has_shift(&self) -> bool
pub fn has_alt(&self) -> bool
pub fn label(&self, conventions: PlatformConventions) -> String
pub fn keycap_labels(&self, conventions: PlatformConventions) -> Vec<String>
pub fn keycap_labels(&self, conventions: PlatformConventions) -> Vec<String>
Labels to paint as individual physical-looking caps, in the legends
of the active keyboard layout (crate::keycaps::active).
pub fn matches(
&self,
key: &Key,
modifiers: ModifiersState,
conventions: PlatformConventions,
) -> bool
pub fn matches( &self, key: &Key, modifiers: ModifiersState, conventions: PlatformConventions, ) -> bool
Whether the press of key with modifiers asks for this shortcut: the
same key, with exactly the modifiers it names. A command modifier is
the platform’s own (PlatformConventions::command_modifier), so a
declared Ctrl+Enter is Command+Enter on a Mac and Ctrl+Enter
elsewhere, and no other modifier held along with it matches.
pub fn pressed(
key: &Key,
modifiers: ModifiersState,
conventions: PlatformConventions,
) -> Option<Shortcut>
pub fn pressed( key: &Key, modifiers: ModifiersState, conventions: PlatformConventions, ) -> Option<Shortcut>
The shortcut a live press asks for, in conventions’ spelling, or
None for a key no shortcut can name.
pub fn same_press(&self, other: &Shortcut) -> bool
pub fn same_press(&self, other: &Shortcut) -> bool
Whether both ask for one press: one key, in one spelling, with the same modifiers.
Trait Implementations§
§impl From<&str> for Shortcut
A chord as an app, a menu or the person’s table writes it (Ctrl+Enter,
Super+W, F2, e): one table for the modifiers and the key names it
parses with ([tilo_ui_graph::keys::Chord]), the same one the compiler
checks an app’s declared shortcut against.
impl From<&str> for Shortcut
A chord as an app, a menu or the person’s table writes it (Ctrl+Enter,
Super+W, F2, e): one table for the modifiers and the key names it
parses with ([tilo_ui_graph::keys::Chord]), the same one the compiler
checks an app’s declared shortcut against.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§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>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§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.§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.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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