hinge_angle/
lib.rs

1#![doc = include_str!("../README.md")]
2#[cfg(target_os = "android")]
3pub mod android;
4pub mod fake;
5#[cfg(target_os = "macos")]
6pub mod macos;
7
8/// Trait representing devices that can provide angle measurements.
9pub trait HingeAngle {
10    /// The output type for the angle measurement.
11    /// This could be a simple numeric type depending on the device precision.
12    type Output;
13
14    /// Retrieves the current hinge angle.
15    fn angle(&self) -> Self::Output;
16}
17
18#[cfg(test)]
19mod tests {
20    use super::*;
21    use crate::fake::Hinge;
22
23    #[test]
24    fn test_angle() {
25        let hinge = Hinge(42.0);
26        assert_eq!(hinge.angle(), 42.0);
27    }
28}