hinge-angle 0.1.0

A crate for accessing hinge angle sensors on various platforms
Documentation
#![doc = include_str!("../README.md")]
#[cfg(target_os = "android")]
pub mod android;
pub mod fake;
#[cfg(target_os = "macos")]
pub mod macos;

/// Trait representing devices that can provide angle measurements.
pub trait HingeAngle {
    /// The output type for the angle measurement.
    /// This could be a simple numeric type depending on the device precision.
    type Output;

    /// Retrieves the current hinge angle.
    fn angle(&self) -> Self::Output;
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::fake::Hinge;

    #[test]
    fn test_angle() {
        let hinge = Hinge(42.0);
        assert_eq!(hinge.angle(), 42.0);
    }
}