pub struct KeyBinding {
pub keystrokes: Vec<Keystroke>,
pub action: Box<dyn Action>,
pub context: Option<&'static str>,
}Expand description
A binding from a keystroke sequence to an action.
Fields§
§keystrokes: Vec<Keystroke>§action: Box<dyn Action>§context: Option<&'static str>If set, the binding is only active when an element on the focus path declares this key context.
Implementations§
Source§impl KeyBinding
impl KeyBinding
Sourcepub fn new(keystrokes: &str, action: impl Action) -> KeyBinding
pub fn new(keystrokes: &str, action: impl Action) -> KeyBinding
Creates a binding. Panics on an invalid keystroke string (bindings are
almost always literals; use KeyBinding::try_new for user input).
pub fn try_new( keystrokes: &str, action: impl Action, ) -> Result<KeyBinding, KeystrokeParseError>
pub fn context(self, context: &'static str) -> Self
Trait Implementations§
Source§impl Clone for KeyBinding
impl Clone for KeyBinding
Auto Trait Implementations§
impl !RefUnwindSafe for KeyBinding
impl !Send for KeyBinding
impl !Sync for KeyBinding
impl !UnwindSafe for KeyBinding
impl Freeze for KeyBinding
impl Unpin for KeyBinding
impl UnsafeUnpin 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