pub struct KeyBinding {
pub key: KeyCode,
pub modifiers: KeyModifiers,
pub action: &'static str,
pub description: &'static str,
pub show: bool,
}Expand description
A key binding declaration on a widget.
Widgets return these from key_bindings() to declare keyboard shortcuts.
Fields§
§key: KeyCodeThe key that triggers this binding.
modifiers: KeyModifiersRequired modifier keys (e.g., CONTROL, SHIFT). Use KeyModifiers::NONE for no modifiers.
action: &'static strAction string dispatched to on_action when this binding fires.
description: &'static strHuman-readable description (shown in Footer widget).
show: boolWhether to display this binding in the Footer. Set false for internal bindings.
Implementations§
Source§impl KeyBinding
impl KeyBinding
Sourcepub fn matches(&self, key: KeyCode, modifiers: KeyModifiers) -> bool
pub fn matches(&self, key: KeyCode, modifiers: KeyModifiers) -> bool
Check if a key event matches this binding.
Trait Implementations§
Source§impl Clone for KeyBinding
impl Clone for KeyBinding
Source§fn clone(&self) -> KeyBinding
fn clone(&self) -> KeyBinding
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 moreAuto Trait Implementations§
impl Freeze for KeyBinding
impl RefUnwindSafe for KeyBinding
impl Send for KeyBinding
impl Sync for KeyBinding
impl Unpin for KeyBinding
impl UnsafeUnpin for KeyBinding
impl UnwindSafe for KeyBinding
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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 moreSource§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.