1use crate::event_codes::AbsoluteAxis;
2use crate::GenericEvent;
3
4#[derive(Clone, Copy, Debug)]
8pub struct AxisEvent {
9 axis: AbsoluteAxis,
10 is_synthetic: bool,
11 time: u32,
12 value: i16,
13}
14
15impl AxisEvent {
16 pub const fn axis(self) -> AbsoluteAxis {
18 self.axis
19 }
20
21 pub(crate) const fn new(axis: AbsoluteAxis, is_synthetic: bool, time: u32, value: i16) -> Self {
22 AxisEvent {
23 axis,
24 is_synthetic,
25 time,
26 value,
27 }
28 }
29}
30
31impl GenericEvent for AxisEvent {
32 fn is_real(&self) -> bool {
33 !self.is_synthetic
34 }
35
36 fn is_synthetic(&self) -> bool {
37 self.is_synthetic
38 }
39
40 fn time(&self) -> u32 {
41 self.time
42 }
43
44 fn value(&self) -> i16 {
45 self.value
46 }
47}