Sfoglia il codice sorgente

percent-encoding: Allow to remove character from AsciiSet

Douman 7 anni fa
parent
commit
0d33781fbb
1 ha cambiato i file con 6 aggiunte e 0 eliminazioni
  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);
         mask[byte as usize / BITS_PER_CHUNK] |= 1 << (byte as usize % BITS_PER_CHUNK);
         AsciiSet { mask }
         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).
 /// The set of 0x00 to 0x1F (C0 controls), and 0x7F (DEL).