Crates.io | rjdebounce |
lib.rs | rjdebounce |
version | 0.2.1 |
source | src |
created_at | 2020-05-30 08:25:02.222934 |
updated_at | 2020-05-30 10:30:23.674962 |
description | Debouncing function utility |
homepage | https://github.com/jackmead515/rjdebounce |
repository | https://github.com/jackmead515/rjdebounce |
max_upload_size | |
id | 247630 |
size | 6,888 |
use rjdebounce::Bouncer;
let mut bouncer = Bouncer::new(Duration::from_secs(1));
let result = bouncer.debounce(|| {
return 5 + 5;
})
assert_eq!(result.is_some(), true);
assert_eq!(result.unwrap(), 10);
use rjdebounce::Bouncer;
let func = || 5 + 6;
let delay = Duration::from_secs(1);
let mut bouncer = Bouncer::new(delay).with_func(func);
assert_eq!(bouncer.get_result().is_some(), false);
bouncer.execute();
assert_eq!(bouncer.get_result().is_some(), true);
Yeah absolutely. I'd love to make a bigger lib.
I mean... sure, if you want. But this is just practice for me. I do not have a licence for this and I purely wrote it to get a feel for cargo and package management. I will use this in my personal projects though. So feel free!