television/screen/
keybindings.rs1use crate::{
2 action::{Action, Actions},
3 config::Keybindings,
4};
5
6pub fn find_keys_for_single_action(
8 keybindings: &Keybindings,
9 target_action: &Action,
10) -> Vec<String> {
11 keybindings
12 .iter()
13 .filter_map(|(key, actions)| {
14 if actions.as_slice().contains(target_action) {
16 Some(key.to_string())
17 } else {
18 None
19 }
20 })
21 .collect()
22}
23
24pub fn remove_action_bindings(
26 keybindings: &mut Keybindings,
27 target_action: &Actions,
28) {
29 keybindings.retain(|_, action| action != target_action);
30}