rstmt_core/octave/impls/
impl_octave.rs

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