Przeglądaj źródła

percent-encoding: Allow to remove character from AsciiSet

Douman 7 lat temu
rodzic
commit
0d33781fbb
1 zmienionych plików z 6 dodań i 0 usunięć
  1. 6 0
      percent_encoding/lib.rs

+ 6 - 0
percent_encoding/lib.rs

@@ -83,6 +83,12 @@ impl AsciiSet {
         mask[byte as usize / BITS_PER_CHUNK] |= 1 << (byte as usize % BITS_PER_CHUNK);
         AsciiSet { mask }
     }
+
+    pub const fn remove(&self, byte: u8) -> Self {
+        let mut mask = self.mask;
+        mask[byte as usize / BITS_PER_CHUNK] &= !(1 << (byte as usize % BITS_PER_CHUNK));
+        AsciiSet { mask }
+    }
 }
 
 /// The set of 0x00 to 0x1F (C0 controls), and 0x7F (DEL).