notify_types/
debouncer_full.rs1use std::ops::{Deref, DerefMut};
2
3#[cfg(feature = "web-time")]
4use web_time::Instant;
5
6#[cfg(not(feature = "web-time"))]
7use std::time::Instant;
8
9use crate::event::Event;
10
11#[derive(Debug, Clone, PartialEq, Eq)]
13pub struct DebouncedEvent {
14 pub event: Event,
16
17 pub time: Instant,
19}
20
21impl DebouncedEvent {
22 #[must_use]
23 pub fn new(event: Event, time: Instant) -> Self {
24 Self { event, time }
25 }
26}
27
28impl Deref for DebouncedEvent {
29 type Target = Event;
30
31 fn deref(&self) -> &Self::Target {
32 &self.event
33 }
34}
35
36impl DerefMut for DebouncedEvent {
37 fn deref_mut(&mut self) -> &mut Self::Target {
38 &mut self.event
39 }
40}