hinge-angle 0.1.0

A crate for accessing hinge angle sensors on various platforms
Documentation
//! Fake hinge angle sensor for testing purposes.
//! This crate is os-specific, but this module provides a fake implementation for easier testing on unsupported platforms,
//! doc generation, and development.
//! See platform-specific modules locally or consult README.md for more details.

use crate::HingeAngle;

/// Fake hinge angle sensor for testing purposes.
#[derive(Debug)]
pub struct Hinge(pub f64);

impl Hinge {
    /// Creates a new fake hinge angle sensor with the specified angle.
    pub fn new(angle: f64) -> Self {
        Hinge(angle)
    }
}

impl HingeAngle for Hinge {
    type Output = f64;

    fn angle(&self) -> Self::Output {
        self.0
    }
}