Implement std::fmt::Display for iced::Radians (#2446)
* 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>
This commit is contained in:
parent
368b15f708
commit
19db068bbb
1 changed files with 7 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::{Point, Rectangle, Vector};
|
use crate::{Point, Rectangle, Vector};
|
||||||
|
|
||||||
use std::f32::consts::{FRAC_PI_2, PI};
|
use std::f32::consts::{FRAC_PI_2, PI};
|
||||||
|
use std::fmt::Display;
|
||||||
use std::ops::{Add, AddAssign, Div, Mul, RangeInclusive, Rem, Sub, SubAssign};
|
use std::ops::{Add, AddAssign, Div, Mul, RangeInclusive, Rem, Sub, SubAssign};
|
||||||
|
|
||||||
/// Degrees
|
/// Degrees
|
||||||
|
|
@ -237,3 +238,9 @@ impl PartialOrd<f32> for Radians {
|
||||||
self.0.partial_cmp(other)
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue