1use expr::Expr;
2use std::convert::Into;
3
4pub trait And<T, RHS> {
5 fn and(self, rhs: RHS) -> Expr<T>;
6}
7
8impl<T, LHS, RHS> And<T, RHS> for LHS
9where
10 RHS: Into<Expr<T>>,
11 LHS: Into<Expr<T>>,
12{
13 fn and(self, e: RHS) -> Expr<T> {
14 Expr::And(Box::new(self.into()), Box::new(e.into()))
15 }
16}
17
18pub trait Or<T, RHS> {
19 fn or(self, rhs: RHS) -> Expr<T>;
20}
21
22impl<T, LHS, RHS> Or<T, RHS> for LHS
23where
24 RHS: Into<Expr<T>>,
25 LHS: Into<Expr<T>>,
26{
27 fn or(self, e: RHS) -> Expr<T> {
28 Expr::Or(Box::new(self.into()), Box::new(e.into()))
29 }
30}
31
32pub trait Xor<T, RHS> {
33 fn xor(self, rhs: RHS) -> Expr<T>;
34}
35
36impl<T, LHS, RHS> Xor<T, RHS> for LHS
37where
38 RHS: Into<Expr<T>>,
39 LHS: Into<Expr<T>>,
40{
41 fn xor(self, e: RHS) -> Expr<T> {
42 Expr::Xor(Box::new(self.into()), Box::new(e.into()))
43 }
44}
45
46pub trait Implies<T, RHS> {
47 fn implies(self, rhs: RHS) -> Expr<T>;
48}
49
50impl<T, LHS, RHS> Implies<T, RHS> for LHS
51where
52 RHS: Into<Expr<T>>,
53 LHS: Into<Expr<T>>,
54{
55 fn implies(self, e: RHS) -> Expr<T> {
56 Expr::Implies(Box::new(self.into()), Box::new(e.into()))
57 }
58}
59
60pub trait Equivalent<T, RHS> {
61 fn equivalent(self, rhs: RHS) -> Expr<T>;
62}
63
64impl<T, LHS, RHS> Equivalent<T, RHS> for LHS
65where
66 RHS: Into<Expr<T>>,
67 LHS: Into<Expr<T>>,
68{
69 fn equivalent(self, e: RHS) -> Expr<T> {
70 Expr::Equivalent(Box::new(self.into()), Box::new(e.into()))
71 }
72}