joydev/generic_event.rs
1use std::fmt::Debug;
2use std::hash::Hash;
3
4/// Trait common to all events
5pub trait GenericEvent
6where
7 Self: Clone + Copy + Debug + Eq + Hash + PartialEq,
8{
9 /// Returns `true` if the event is real
10 fn is_real(&self) -> bool;
11
12 /// Returns `true` if the event is synthetic
13 fn is_synthetic(&self) -> bool;
14
15 /// Returns the event's timestamp
16 fn time(&self) -> u32;
17
18 /// Returns the event's value
19 fn value(&self) -> i16;
20}