@@ -48,6 +48,30 @@ pub enum CloseMethodSet {
48
48
Both = 0x03 ,
49
49
}
50
50
51
+ impl BitOr < Option < CloseMethodSet > > for CloseMethodSet {
52
+ type Output = Self ;
53
+ fn bitor ( mut self , rhs : Option < CloseMethodSet > ) -> Self :: Output {
54
+ rhs. map ( |m| self |= m) ;
55
+ self
56
+ }
57
+ }
58
+
59
+ impl BitOrAssign < Option < CloseMethodSet > > for CloseMethodSet {
60
+ fn bitor_assign ( & mut self , rhs : Option < CloseMethodSet > ) { rhs. map ( |m| * self |= m) ; }
61
+ }
62
+
63
+ impl BitOr < CloseMethodSet > for Option < CloseMethodSet > {
64
+ type Output = CloseMethodSet ;
65
+ fn bitor ( self , mut rhs : CloseMethodSet ) -> Self :: Output {
66
+ self . map ( |m| rhs |= m) ;
67
+ rhs
68
+ }
69
+ }
70
+
71
+ impl BitOrAssign < CloseMethodSet > for Option < CloseMethodSet > {
72
+ fn bitor_assign ( & mut self , rhs : CloseMethodSet ) { * self = Some ( rhs | * self ) }
73
+ }
74
+
51
75
impl BitOr for CloseMethodSet {
52
76
type Output = Self ;
53
77
fn bitor ( self , rhs : Self ) -> Self :: Output { if self == rhs { self } else { Self :: Both } }
@@ -70,6 +94,11 @@ impl From<CloseMethod> for CloseMethodSet {
70
94
}
71
95
}
72
96
97
+ impl CloseMethodSet {
98
+ pub fn has_tapret_first ( self ) -> bool { matches ! ( self , Self :: TapretFirst | Self :: Both ) }
99
+ pub fn has_opret_first ( self ) -> bool { matches ! ( self , Self :: OpretFirst | Self :: Both ) }
100
+ }
101
+
73
102
#[ derive( Clone , PartialEq , Eq , Hash , Debug ) ]
74
103
#[ derive( StrictType , StrictEncode , StrictDecode ) ]
75
104
#[ strict_type( lib = LIB_NAME_RGB_STD ) ]
0 commit comments