kb

Macro kb 

Source
macro_rules! kb {
    ($($key:expr => $action:expr),* $(,)?) => { ... };
    ($(($key:expr, $action:expr)),* $(,)?) => { ... };
}
Expand description

Creates an array of keybindings.

Each action will be converted into an ActionKind.

This macro accepts two syntaxes:

  1. <key> => <action> syntax:
let keybindings = kb![
    "<q>" => Action::Quit,
    "d" => "app:drink-mate"
];
  1. (<key>, <action>) syntax:
let keybindings = kb![
    ("<q>", Action::Quit),
    ("d", "app:drink-mate")
];