Struct debounce::thread::EventDebouncer
source · pub struct EventDebouncer<T>(_);
Expand description
Threaded debouncer wrapping EventBuffer. Accepts a common delay and a callback function which is going to be called by a background thread with debounced events.
Implementations§
source§impl<T: PartialEq> EventDebouncer<T>
impl<T: PartialEq> EventDebouncer<T>
pub fn new<F>(delay: Duration, f: F) -> Selfwhere F: FnMut(T) + Send + 'static, T: Send + 'static,
pub fn put(&self, data: T)
sourcepub fn stop(self) -> JoinHandle<()>
pub fn stop(self) -> JoinHandle<()>
Signals the debouncer thread to quit and returns a
std::thread::JoinHandle which can be .join()
ed in the consumer
thread. The common idiom is: debouncer.stop().join().unwrap();
Auto Trait Implementations§
impl<T> !RefUnwindSafe for EventDebouncer<T>
impl<T> Send for EventDebouncer<T>where T: Send,
impl<T> Sync for EventDebouncer<T>where T: Send,
impl<T> Unpin for EventDebouncer<T>
impl<T> !UnwindSafe for EventDebouncer<T>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more