rstmt_core/freq/impls/
impl_freq.rs

1/*
2    appellation: impl_freq <module>
3    authors: @FL03
4*/
5use crate::freq::Frequency;
6
7impl<T> PartialEq<T> for Frequency<T>
8where
9    T: PartialEq,
10{
11    fn eq(&self, other: &T) -> bool {
12        &self.0 == other
13    }
14}
15
16impl<'a, T> PartialEq<&'a T> for Frequency<T>
17where
18    T: PartialEq,
19{
20    fn eq(&self, other: &&'a T) -> bool {
21        &self.0 == *other
22    }
23}
24
25impl<'a, T> PartialEq<&'a mut T> for Frequency<T>
26where
27    T: PartialEq,
28{
29    fn eq(&self, other: &&'a mut T) -> bool {
30        &self.0 == *other
31    }
32}
33
34impl<T> PartialOrd<T> for Frequency<T>
35where
36    T: PartialOrd,
37{
38    fn partial_cmp(&self, other: &T) -> Option<core::cmp::Ordering> {
39        self.0.partial_cmp(other)
40    }
41}
42
43impl<'a, T> PartialOrd<&'a T> for Frequency<T>
44where
45    T: PartialOrd,
46{
47    fn partial_cmp(&self, other: &&'a T) -> Option<core::cmp::Ordering> {
48        self.0.partial_cmp(*other)
49    }
50}
51
52impl<'a, T> PartialOrd<&'a mut T> for Frequency<T>
53where
54    T: PartialOrd,
55{
56    fn partial_cmp(&self, other: &&'a mut T) -> Option<core::cmp::Ordering> {
57        self.0.partial_cmp(*other)
58    }
59}
60
61impl<T> AsRef<T> for Frequency<T> {
62    fn as_ref(&self) -> &T {
63        &self.0
64    }
65}
66
67impl<T> AsMut<T> for Frequency<T> {
68    fn as_mut(&mut self) -> &mut T {
69        &mut self.0
70    }
71}
72
73impl<T> core::borrow::Borrow<T> for Frequency<T> {
74    fn borrow(&self) -> &T {
75        &self.0
76    }
77}
78
79impl<T> core::borrow::BorrowMut<T> for Frequency<T> {
80    fn borrow_mut(&mut self) -> &mut T {
81        &mut self.0
82    }
83}
84
85impl<T> core::ops::Deref for Frequency<T> {
86    type Target = T;
87
88    fn deref(&self) -> &Self::Target {
89        &self.0
90    }
91}
92
93impl<T> core::ops::DerefMut for Frequency<T> {
94    fn deref_mut(&mut self) -> &mut Self::Target {
95        &mut self.0
96    }
97}