We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 3cb4720 commit 48b40a2Copy full SHA for 48b40a2
src/lib.rs
@@ -55,6 +55,16 @@ impl KeyState {
55
Self::Up => "keyup",
56
}
57
58
+
59
+ /// True if the key is pressed down.
60
+ pub const fn is_down(self) -> bool {
61
+ matches!(self, Self::Down)
62
+ }
63
64
+ /// True if the key is released.
65
+ pub const fn is_up(self) -> bool {
66
+ matches!(self, Self::Up)
67
68
69
70
/// Keyboard events are issued for all pressed and released keys.
src/shortcuts.rs
@@ -85,7 +85,7 @@ impl<T> ShortcutMatcher<T> {
85
return self;
86
87
if modifiers == self.modifiers && key.match_key(&self.key) {
88
- if self.state == KeyState::Down {
+ if self.state.is_down() {
89
self.value = Some(f());
90
91
self.matched = true;
0 commit comments