summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-16 16:52:21 +0100
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-03-16 16:52:21 +0100
commitbad3b1ac4777b4d9b57c6ba9473fb97753a77124 (patch)
treeb5675155923b3576df03a6ed67d0943807a38493 /core
parent348e00e11cd976a16493f4ce693db614886c1ecd (diff)
downloadiced-bad3b1ac4777b4d9b57c6ba9473fb97753a77124.tar.gz
iced-bad3b1ac4777b4d9b57c6ba9473fb97753a77124.tar.bz2
iced-bad3b1ac4777b4d9b57c6ba9473fb97753a77124.zip
Show name of current `Theme` in `clock` example
Diffstat (limited to 'core')
-rw-r--r--core/src/angle.rs24
1 files changed, 24 insertions, 0 deletions
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<f32> for Degrees {
+ fn eq(&self, other: &f32) -> bool {
+ self.0.eq(other)
+ }
+}
+
+impl PartialOrd<f32> for Degrees {
+ fn partial_cmp(&self, other: &f32) -> Option<std::cmp::Ordering> {
+ 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<f32> for Radians {
+ fn eq(&self, other: &f32) -> bool {
+ self.0.eq(other)
+ }
+}
+
+impl PartialOrd<f32> for Radians {
+ fn partial_cmp(&self, other: &f32) -> Option<std::cmp::Ordering> {
+ self.0.partial_cmp(other)
+ }
+}