value_trait/node/
cmp.rs

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