hinge_angle/fake.rs
1//! Fake hinge angle sensor for testing purposes.
2//! This crate is os-specific, but this module provides a fake implementation for easier testing on unsupported platforms,
3//! doc generation, and development.
4//! See platform-specific modules locally or consult README.md for more details.
5
6use crate::HingeAngle;
7
8/// Fake hinge angle sensor for testing purposes.
9#[derive(Debug)]
10pub struct Hinge(pub f64);
11
12impl Hinge {
13 /// Creates a new fake hinge angle sensor with the specified angle.
14 pub fn new(angle: f64) -> Self {
15 Hinge(angle)
16 }
17}
18
19impl HingeAngle for Hinge {
20 type Output = f64;
21
22 fn angle(&self) -> Self::Output {
23 self.0
24 }
25}