summaryrefslogtreecommitdiff
path: root/src/geom/angle.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2021-08-21 16:38:51 +0200
committerLaurenz <laurmaedje@gmail.com>2021-08-21 17:30:21 +0200
commit0dd4ae0a7ac0c247078df492469ff20b8a90c886 (patch)
tree07a55343b9ccab3fe76b0f1b0de9d1be310d8b14 /src/geom/angle.rs
parentf38eb10c2b54bd13ccef119454839f6a66448462 (diff)
Prune derives
Diffstat (limited to 'src/geom/angle.rs')
-rw-r--r--src/geom/angle.rs21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/geom/angle.rs b/src/geom/angle.rs
index 8f18210c..cf3e49a0 100644
--- a/src/geom/angle.rs
+++ b/src/geom/angle.rs
@@ -1,8 +1,11 @@
-use super::*;
use decorum::N64;
+use serde::{Deserialize, Serialize};
+
+use super::*;
/// An angle.
#[derive(Default, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
+#[derive(Serialize, Deserialize)]
pub struct Angle(N64);
impl Angle {
@@ -52,6 +55,13 @@ impl Angle {
}
}
+impl Debug for Angle {
+ fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ let unit = AngularUnit::Deg;
+ write!(f, "{}{}", self.to_unit(unit), unit)
+ }
+}
+
impl Display for Angle {
fn fmt(&self, f: &mut Formatter) -> fmt::Result {
// Format with the unit that yields the shortest output, preferring
@@ -66,13 +76,6 @@ impl Display for Angle {
}
}
-impl Debug for Angle {
- fn fmt(&self, f: &mut Formatter) -> fmt::Result {
- let unit = AngularUnit::Deg;
- write!(f, "{}{}", self.to_unit(unit), unit)
- }
-}
-
impl Neg for Angle {
type Output = Self;
@@ -134,7 +137,7 @@ impl Sum for Angle {
}
}
/// Different units of angular measurement.
-#[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd)]
+#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum AngularUnit {
/// Radians.
Rad,