Skip to main content

dualsense_tools/state/
gyro.rs

1use std::ops::{Deref, DerefMut};
2
3use crate::state::SpatialSensor;
4
5/// Represents readings from a gyroscope
6#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Hash)]
7pub struct Gyro<V>(SpatialSensor<V>);
8
9impl<V> Gyro<V> {
10    pub fn new(x: V, y: V, z: V) -> Gyro<V> {
11        Gyro(SpatialSensor { x, y, z })
12    }
13}
14
15impl<V> Deref for Gyro<V> {
16    type Target = SpatialSensor<V>;
17
18    fn deref(&self) -> &Self::Target {
19        &self.0
20    }
21}
22
23impl<V> DerefMut for Gyro<V> {
24    fn deref_mut(&mut self) -> &mut Self::Target {
25        &mut self.0
26    }
27}