dualsense-tools 0.2.0

Tools to interact with the Dualsense PS5 controller
Documentation
use std::ops::{Deref, DerefMut};

use crate::state::SpatialSensor;

/// Represents readings from a gyroscope
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq, Hash)]
pub struct Gyro<V>(SpatialSensor<V>);

impl<V> Gyro<V> {
    pub fn new(x: V, y: V, z: V) -> Gyro<V> {
        Gyro(SpatialSensor { x, y, z })
    }
}

impl<V> Deref for Gyro<V> {
    type Target = SpatialSensor<V>;

    fn deref(&self) -> &Self::Target {
        &self.0
    }
}

impl<V> DerefMut for Gyro<V> {
    fn deref_mut(&mut self) -> &mut Self::Target {
        &mut self.0
    }
}