devela/num/geom/metric/angle/impl/
core_traits.rs
1use crate::{Angle, ConstDefault, Debug, FmtResult, Formatter, Ordering};
7
8impl<T: Clone> Clone for Angle<T> {
12 fn clone(&self) -> Self {
13 Self::new(self.turn.clone())
14 }
15}
16
17impl<T: Copy> Copy for Angle<T> {}
19
20impl<T: Default> Default for Angle<T> {
23 fn default() -> Self {
26 Self::new(T::default())
27 }
28}
29
30impl<T: ConstDefault> ConstDefault for Angle<T> {
32 const DEFAULT: Self = { Self::new(T::DEFAULT) };
35}
36
37impl<T: Debug> Debug for Angle<T> {
39 fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult<()> {
40 write!(f, "Angle({:?})", self.turn)
41 }
42}
43
44impl<T: PartialEq> PartialEq for Angle<T> {
46 fn eq(&self, other: &Self) -> bool {
47 self.turn == other.turn
48 }
49}
50impl<T: Eq> Eq for Angle<T> {}
52
53impl<T: PartialOrd> PartialOrd for Angle<T> {
55 fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
56 self.turn.partial_cmp(&other.turn)
57 }
58}
59
60impl<T: Ord> Ord for Angle<T> {
62 fn cmp(&self, other: &Self) -> Ordering {
63 self.turn.cmp(&other.turn)
64 }
65}