macro_rules! key {
($($tt:tt)*) => { ... };
}Expand description
check and expand at compile-time the provided expression into a valid KeyCombination.
For example:
let key_event = key!(ctrl-c);is expanded into (roughly):
let key_event = crokey::KeyCombination {
modifiers: crossterm::event::KeyModifiers::CONTROL,
codes: crokey::OneToThree::One(crossterm::event::KeyCode::Char('c')),
};Keys which can’t be valid identifiers or digits in Rust must be put between simple quotes:
let ke = key!(shift-'?');
let ke = key!(alt-']');