scratch_test_value/comparisons/
logic.rs1use crate::{QuirkSink, SValue, quirks::SValueToBoolQ};
2
3impl SValue {
4 pub fn q_and<Q>(&self, other: &SValue, sink: &mut Q) -> bool
5 where
6 Q: QuirkSink<SValueToBoolQ>,
7 {
8 let a = self.q_as_bool(sink);
9 let b = other.q_as_bool(sink);
10 a && b
11 }
12 pub fn q_or<Q>(&self, other: &SValue, sink: &mut Q) -> bool
13 where
14 Q: QuirkSink<SValueToBoolQ>,
15 {
16 let a = self.q_as_bool(sink);
17 let b = other.q_as_bool(sink);
18 a || b
19 }
20 pub fn q_not<Q>(&self, sink: &mut Q) -> bool
21 where
22 Q: QuirkSink<SValueToBoolQ>,
23 {
24 !self.q_as_bool(sink)
25 }
26
27 #[allow(unused)]
28 pub(crate) fn and(&self, other: &SValue) -> bool {
29 self.q_and(other, &mut ())
33 }
34
35 #[allow(unused)]
36 pub(crate) fn or(&self, other: &SValue) -> bool {
37 self.q_or(other, &mut ())
41 }
42
43 #[allow(unused)]
44 pub(crate) fn not(&self) -> bool {
45 self.q_not(&mut ())
49 }
50}