value_trait/node/
cmp.rs

1use crate::{base::ValueAsScalar, derived::TypedScalarValue};
2
3use super::StaticNode;
4
5impl PartialEq<()> for StaticNode {
6    #[inline]
7    #[must_use]
8    fn eq(&self, _other: &()) -> bool {
9        self.is_null()
10    }
11}
12
13impl PartialEq<bool> for StaticNode {
14    #[inline]
15    #[must_use]
16    fn eq(&self, other: &bool) -> bool {
17        self.as_bool().is_some_and(|t| t.eq(other))
18    }
19}
20
21impl PartialEq<str> for StaticNode {
22    #[inline]
23    #[must_use]
24    fn eq(&self, other: &str) -> bool {
25        self.as_str().is_some_and(|t| t.eq(other))
26    }
27}
28
29impl PartialEq<&str> for StaticNode {
30    #[inline]
31    #[must_use]
32    fn eq(&self, other: &&str) -> bool {
33        self == *other
34    }
35}
36
37impl PartialEq<String> for StaticNode {
38    #[inline]
39    #[must_use]
40    fn eq(&self, other: &String) -> bool {
41        self.as_str().is_some_and(|t| t.eq(other))
42    }
43}
44
45impl PartialEq<i8> for StaticNode {
46    #[inline]
47    #[must_use]
48    fn eq(&self, other: &i8) -> bool {
49        self.as_i8().is_some_and(|t| t.eq(other))
50    }
51}
52
53impl PartialEq<i16> for StaticNode {
54    #[inline]
55    #[must_use]
56    fn eq(&self, other: &i16) -> bool {
57        self.as_i16().is_some_and(|t| t.eq(other))
58    }
59}
60
61impl PartialEq<i32> for StaticNode {
62    #[inline]
63    #[must_use]
64    fn eq(&self, other: &i32) -> bool {
65        self.as_i32().is_some_and(|t| t.eq(other))
66    }
67}
68
69impl PartialEq<i64> for StaticNode {
70    #[inline]
71    #[must_use]
72    fn eq(&self, other: &i64) -> bool {
73        self.as_i64().is_some_and(|t| t.eq(other))
74    }
75}
76
77impl PartialEq<i128> for StaticNode {
78    #[inline]
79    #[must_use]
80    fn eq(&self, other: &i128) -> bool {
81        self.as_i128().is_some_and(|t| t.eq(other))
82    }
83}
84
85impl PartialEq<u8> for StaticNode {
86    #[inline]
87    #[must_use]
88    fn eq(&self, other: &u8) -> bool {
89        self.as_u8().is_some_and(|t| t.eq(other))
90    }
91}
92
93impl PartialEq<u16> for StaticNode {
94    #[inline]
95    #[must_use]
96    fn eq(&self, other: &u16) -> bool {
97        self.as_u16().is_some_and(|t| t.eq(other))
98    }
99}
100
101impl PartialEq<u32> for StaticNode {
102    #[inline]
103    #[must_use]
104    fn eq(&self, other: &u32) -> bool {
105        self.as_u32().is_some_and(|t| t.eq(other))
106    }
107}
108
109impl PartialEq<u64> for StaticNode {
110    #[inline]
111    #[must_use]
112    fn eq(&self, other: &u64) -> bool {
113        self.as_u64().is_some_and(|t| t.eq(other))
114    }
115}
116
117impl PartialEq<usize> for StaticNode {
118    #[inline]
119    #[must_use]
120    fn eq(&self, other: &usize) -> bool {
121        self.as_usize().is_some_and(|t| t.eq(other))
122    }
123}
124
125impl PartialEq<u128> for StaticNode {
126    #[inline]
127    #[must_use]
128    fn eq(&self, other: &u128) -> bool {
129        self.as_u128().is_some_and(|t| t.eq(other))
130    }
131}
132
133impl PartialEq<f32> for StaticNode {
134    #[inline]
135    #[must_use]
136    fn eq(&self, other: &f32) -> bool {
137        self.as_f32().is_some_and(|t| t.eq(other))
138    }
139}
140impl PartialEq<f64> for StaticNode {
141    #[inline]
142    #[must_use]
143    fn eq(&self, other: &f64) -> bool {
144        self.as_f64().is_some_and(|t| t.eq(other))
145    }
146}