1use crate::inputs::hotkeys::HotKey;
2use crossterm::event::KeyEvent;
3use derive_more::Constructor;
4
5#[derive(Clone, Debug, Eq, PartialEq, Constructor)]
7pub struct Matcher {
8 hotkeys: Vec<HotKey>,
9 name: String,
10}
11impl Matcher {
12 #[must_use]
14 pub fn matches(&self, event: &KeyEvent) -> bool {
15 self.hotkeys.iter().any(|hotkey| hotkey.matches(event))
16 }
17
18 #[must_use]
20 pub fn hotkeys(&self) -> Vec<HotKey> {
21 self.hotkeys.clone()
22 }
23
24 #[must_use]
26 pub fn name(&self) -> String {
27 self.name.clone()
28 }
29}