Expand description
Keybinding definitions and matching utilities.
This module provides types for defining keybindings and matching them against key events. It’s useful for creating user-configurable keymaps in TUI applications.
§Example
use bubbles::key::{Binding, matches};
let up = Binding::new()
.keys(&["k", "up"])
.help("↑/k", "move up");
let down = Binding::new()
.keys(&["j", "down"])
.help("↓/j", "move down");
// Check if a key matches
assert!(matches("k", &[&up, &down]));
assert!(matches("down", &[&up, &down]));
assert!(!matches("x", &[&up, &down]));Structs§
Functions§
- matches
- Checks if the given key matches any of the given bindings.
- matches_
one - Checks if the given key matches a single binding.