pub struct AsciiClassBitmap { /* private fields */ }Expand description
A 128-bit bitmap for fast ASCII character class membership testing. Each bit represents whether the corresponding ASCII byte (0-127) is in the class.
Implementations§
Source§impl AsciiClassBitmap
impl AsciiClassBitmap
Sourcepub fn from_char_class(class: &CharClass) -> Self
pub fn from_char_class(class: &CharClass) -> Self
Create a bitmap from an AST CharClass.
Sourcepub fn from_hir_class(class: &HirClass) -> Self
pub fn from_hir_class(class: &HirClass) -> Self
Create a bitmap from an IR HirClass.
Sourcepub fn contains_char(&self, ch: char) -> bool
pub fn contains_char(&self, ch: char) -> bool
Check if a character is in the class.
Sourcepub fn find_first(&self, haystack: &[u8]) -> Option<usize>
pub fn find_first(&self, haystack: &[u8]) -> Option<usize>
Find the first position in the slice where any byte matches the class. Returns None if no match is found.
Sourcepub fn find_all(&self, haystack: &[u8]) -> Vec<usize>
pub fn find_all(&self, haystack: &[u8]) -> Vec<usize>
Find all positions where bytes match the class. Returns a vector of indices.
Sourcepub fn count_matches(&self, haystack: &[u8]) -> usize
pub fn count_matches(&self, haystack: &[u8]) -> usize
Count how many bytes in the slice match the class.
Sourcepub fn matches_any(&self, haystack: &[u8]) -> bool
pub fn matches_any(&self, haystack: &[u8]) -> bool
Check if the bitmap matches any byte in the slice.
Trait Implementations§
Source§impl Clone for AsciiClassBitmap
impl Clone for AsciiClassBitmap
Source§fn clone(&self) -> AsciiClassBitmap
fn clone(&self) -> AsciiClassBitmap
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AsciiClassBitmap
impl Debug for AsciiClassBitmap
Source§impl Default for AsciiClassBitmap
impl Default for AsciiClassBitmap
impl Copy for AsciiClassBitmap
Auto Trait Implementations§
impl Freeze for AsciiClassBitmap
impl RefUnwindSafe for AsciiClassBitmap
impl Send for AsciiClassBitmap
impl Sync for AsciiClassBitmap
impl Unpin for AsciiClassBitmap
impl UnsafeUnpin for AsciiClassBitmap
impl UnwindSafe for AsciiClassBitmap
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more