rotated_grid/
angle.rs

1/// An angle expressed in radians.
2pub struct Angle<T>(T);
3
4impl<T> Angle<T> {
5    /// Constructs the value from an angle specified in radians.
6    pub fn from_radians(radians: T) -> Self {
7        Self(radians)
8    }
9
10    /// Converts the value back into radians.
11    pub fn into_radians(self) -> T {
12        self.0
13    }
14}
15
16impl Angle<f64> {
17    /// Constructs the value from an angle specified in degrees.
18    pub fn from_degrees(radians: f64) -> Self {
19        Self(radians.to_radians())
20    }
21}
22
23impl<T: Default> Default for Angle<T> {
24    fn default() -> Self {
25        Self(T::default())
26    }
27}