pub struct KeyMap {
pub bindings: Vec<Binding>,
}Expand description
Declarative key binding map.
§Examples
use slt::KeyMap;
let km = KeyMap::new()
.bind('q', "Quit")
.bind_code(slt::KeyCode::Up, "Move up")
.bind_mod('s', slt::KeyModifiers::CONTROL, "Save")
.bind_hidden('?', "Toggle help");Fields§
§bindings: Vec<Binding>Implementations§
Source§impl KeyMap
impl KeyMap
pub fn new() -> Self
Sourcepub fn bind_code(self, key: KeyCode, description: &str) -> Self
pub fn bind_code(self, key: KeyCode, description: &str) -> Self
Bind a special key (Enter, Esc, Up, Down, etc.).
Sourcepub fn bind_mod(self, key: char, mods: KeyModifiers, description: &str) -> Self
pub fn bind_mod(self, key: char, mods: KeyModifiers, description: &str) -> Self
Bind a key with modifier (Ctrl+S, etc.).
Bind but hide from help bar display.
Sourcepub fn visible_bindings(&self) -> impl Iterator<Item = &Binding>
pub fn visible_bindings(&self) -> impl Iterator<Item = &Binding>
Get visible bindings for help bar rendering.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeyMap
impl RefUnwindSafe for KeyMap
impl Send for KeyMap
impl Sync for KeyMap
impl Unpin for KeyMap
impl UnsafeUnpin for KeyMap
impl UnwindSafe for KeyMap
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