mybatis_sql/
ops_bit_and.rs

1use crate::ops::BitAnd;
2use crate::ops::Value;
3
4impl BitAnd for Value {
5    type Output = bool;
6
7    fn op_bitand(self, rhs: Self) -> Self::Output {
8        self.as_bool().unwrap_or(false) & rhs.as_bool().unwrap_or(false)
9    }
10}
11
12impl BitAnd<Value> for bool {
13    type Output = bool;
14
15    fn op_bitand(self, rhs: Value) -> Self::Output {
16        self & rhs.as_bool().unwrap_or(false)
17    }
18}
19
20//ref value
21impl BitAnd<Value> for &Value {
22    type Output = bool;
23
24    fn op_bitand(self, rhs: Value) -> Self::Output {
25        self.as_bool().unwrap_or(false) & rhs.as_bool().unwrap_or(false)
26    }
27}
28
29impl BitAnd<&Value> for &Value {
30    type Output = bool;
31
32    fn op_bitand(self, rhs: &Value) -> Self::Output {
33        self.as_bool().unwrap_or(false) & rhs.as_bool().unwrap_or(false)
34    }
35}
36
37impl BitAnd<&&Value> for &Value {
38    type Output = bool;
39
40    fn op_bitand(self, rhs: &&Value) -> Self::Output {
41        self.as_bool().unwrap_or(false) & rhs.as_bool().unwrap_or(false)
42    }
43}
44
45impl BitAnd<bool> for &Value {
46    type Output = bool;
47
48    fn op_bitand(self, rhs: bool) -> Self::Output {
49        self.as_bool().unwrap_or(false) & rhs
50    }
51}
52
53//rhs ref
54impl BitAnd<&Value> for Value {
55    type Output = bool;
56
57    fn op_bitand(self, rhs: &Value) -> Self::Output {
58        self.as_bool().unwrap_or(false) & rhs.as_bool().unwrap_or(false)
59    }
60}
61
62impl BitAnd<&Value> for bool {
63    type Output = bool;
64
65    fn op_bitand(self, rhs: &Value) -> Self::Output {
66        self & rhs.as_bool().unwrap_or(false)
67    }
68}
69
70impl BitAnd<&&Value> for Value {
71    type Output = bool;
72
73    fn op_bitand(self, rhs: &&Value) -> Self::Output {
74        self.as_bool().unwrap_or(false) & rhs.as_bool().unwrap_or(false)
75    }
76}
77
78impl BitAnd<&&Value> for bool {
79    type Output = bool;
80
81    fn op_bitand(self, rhs: &&Value) -> Self::Output {
82        self & rhs.as_bool().unwrap_or(false)
83    }
84}