From 19db068bbbebcda1756720525da247f35bd3a5e0 Mon Sep 17 00:00:00 2001
From: SolidStateDj <solidstatedj@proton.me>
Date: Tue, 18 Jun 2024 13:02:15 -0400
Subject: Implement `std::fmt::Display` for `iced::Radians` (#2446)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* Implement `std::fmt::Display` for Radians

* Add ` rad` to the end of all displayed strings.

Co-authored-by: Héctor Ramón <hector0193@gmail.com>

---------

Co-authored-by: Héctor Ramón <hector0193@gmail.com>
---
 core/src/angle.rs | 7 +++++++
 1 file changed, 7 insertions(+)

(limited to 'core')

diff --git a/core/src/angle.rs b/core/src/angle.rs
index 9c8a9b24..0882ae80 100644
--- a/core/src/angle.rs
+++ b/core/src/angle.rs
@@ -1,6 +1,7 @@
 use crate::{Point, Rectangle, Vector};
 
 use std::f32::consts::{FRAC_PI_2, PI};
+use std::fmt::Display;
 use std::ops::{Add, AddAssign, Div, Mul, RangeInclusive, Rem, Sub, SubAssign};
 
 /// Degrees
@@ -237,3 +238,9 @@ impl PartialOrd<f32> for Radians {
         self.0.partial_cmp(other)
     }
 }
+
+impl Display for Radians {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        write!(f, "{} rad", self.0)
+    }
+}
-- 
cgit