Skip to content

Commit e47c25d

Browse files
committed
add macro_rules for config
1 parent 50a4ead commit e47c25d

File tree

4 files changed

+9
-3
lines changed

4 files changed

+9
-3
lines changed

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "debouncer-udevmon"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
edition = "2024"
55
license-file = "LICENSE"
66
description = "linux keyboard debouncer with udevmon"

src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ async fn process_events(mut rx:trpl::Receiver<input::InputEvent>){
4242
input::EV_KEY=>{
4343
let keycode=event.code();
4444
event_cache.push(event);
45-
if event.should_delay(&utils::CONFIG.get().unwrap().exceptions){
45+
if event.should_delay(config!(exceptions)){
4646
is_release_event_last_time=true;
4747
for e in &event_cache{
4848
log::debug!("\x1b[33mdelaying event\x1b[0m: {:?}",e);

src/utils.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,3 +88,9 @@ mod test{
8888
.unwrap();
8989
}
9090
}
91+
#[macro_export]
92+
macro_rules! config{
93+
(exceptions)=>{
94+
&$crate::utils::CONFIG.get().unwrap().exceptions
95+
}
96+
}

0 commit comments

Comments
 (0)