We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 360b17e commit b9f44f6Copy full SHA for b9f44f6
percent_encoding/src/lib.rs
@@ -120,6 +120,15 @@ impl ops::Add for AsciiSet {
120
}
121
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
132
/// The set of 0x00 to 0x1F (C0 controls), and 0x7F (DEL).
133
///
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
0 commit comments