From bad3b1ac4777b4d9b57c6ba9473fb97753a77124 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Sat, 16 Mar 2024 16:52:21 +0100 Subject: Show name of current `Theme` in `clock` example --- core/src/angle.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'core/src/angle.rs') diff --git a/core/src/angle.rs b/core/src/angle.rs index 30ddad83..dc3c0e93 100644 --- a/core/src/angle.rs +++ b/core/src/angle.rs @@ -7,6 +7,18 @@ use std::ops::{Add, AddAssign, Div, Mul, RangeInclusive, Sub, SubAssign}; #[derive(Debug, Copy, Clone, PartialEq, PartialOrd)] pub struct Degrees(pub f32); +impl PartialEq for Degrees { + fn eq(&self, other: &f32) -> bool { + self.0.eq(other) + } +} + +impl PartialOrd for Degrees { + fn partial_cmp(&self, other: &f32) -> Option { + self.0.partial_cmp(other) + } +} + /// Radians #[derive(Debug, Copy, Clone, PartialEq, PartialOrd)] pub struct Radians(pub f32); @@ -140,3 +152,15 @@ impl Div for Radians { Self(self.0 / rhs.0) } } + +impl PartialEq for Radians { + fn eq(&self, other: &f32) -> bool { + self.0.eq(other) + } +} + +impl PartialOrd for Radians { + fn partial_cmp(&self, other: &f32) -> Option { + self.0.partial_cmp(other) + } +} -- cgit