File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -120,6 +120,15 @@ impl ops::Add for AsciiSet {
120
120
}
121
121
}
122
122
123
+ impl ops:: Not for AsciiSet {
124
+ type Output = Self ;
125
+
126
+ fn not ( self ) -> Self {
127
+ let mask = self . mask . map ( |chunk| !chunk) ;
128
+ AsciiSet { mask }
129
+ }
130
+ }
131
+
123
132
/// The set of 0x00 to 0x1F (C0 controls), and 0x7F (DEL).
124
133
///
125
134
/// Note that this includes the newline and tab characters, but not the space 0x20.
@@ -508,4 +517,12 @@ mod tests {
508
517
let expected = AsciiSet :: EMPTY . add ( b'A' ) . add ( b'B' ) ;
509
518
assert_eq ! ( left + right, expected) ;
510
519
}
520
+
521
+ #[ test]
522
+ fn not ( ) {
523
+ let set = AsciiSet :: EMPTY . add ( b'A' ) . add ( b'B' ) ;
524
+ let not_set = !set;
525
+ assert ! ( !not_set. contains( b'A' ) ) ;
526
+ assert ! ( not_set. contains( b'C' ) ) ;
527
+ }
511
528
}
You can’t perform that action at this time.
0 commit comments