pub struct BlockMasks<'a> { /* private fields */ }Expand description
64-byte block masks.
Single-delimiter queries (next) compute only the mask they
need (one load, one cmpeq). Multi-delimiter entry points
(next_any, next_unquoted)
compute every delimiter from the same load in one pass.
Implementations§
Source§impl<'a> BlockMasks<'a>
impl<'a> BlockMasks<'a>
Sourcepub fn new(buf: &'a [u8], delims: &'static [u8]) -> Self
pub fn new(buf: &'a [u8], delims: &'static [u8]) -> Self
Create for buf with delims (static, ≤8, e.g. crxml: [b’<‘,b’>‘,b’“‘,b’'‘,b’=’]).
Sourcepub fn with_quotes(
buf: &'a [u8],
delims: &'static [u8],
quotes: &'static [u8],
) -> Self
pub fn with_quotes( buf: &'a [u8], delims: &'static [u8], quotes: &'static [u8], ) -> Self
Like new but enables next_unquoted
with the given quote characters. Each quote char must be in delims.
Sourcepub fn next(&mut self, from: usize, d: u8) -> Option<usize>
pub fn next(&mut self, from: usize, d: u8) -> Option<usize>
Next occurrence of d at or after from.
Sourcepub fn next_any(&mut self, from: usize, ds: &[u8]) -> Option<(usize, u8)>
pub fn next_any(&mut self, from: usize, ds: &[u8]) -> Option<(usize, u8)>
Next occurrence of any of ds at or after from, returns (pos, delim).
Sourcepub fn next_unquoted(&mut self, from: usize, d: u8) -> Option<usize>
pub fn next_unquoted(&mut self, from: usize, d: u8) -> Option<usize>
Next occurrence of d at or after from that lies outside any
quoted region (per the quote chars given to with_quotes).
Quote regions follow XML attribute-value rules: a value opened by " is
closed only by the next ", and vice versa for '. A quote byte of the
other type inside a value is literal.
This is a forward cursor: quote state is accumulated as the scan
advances, so each call’s from must be ≥ the previously returned
position (the natural from = last_found + 1 loop). Querying a position
behind the cursor resets the quote state, which is only correct if that
earlier prefix has no unbalanced quote.
Auto Trait Implementations§
impl<'a> Freeze for BlockMasks<'a>
impl<'a> RefUnwindSafe for BlockMasks<'a>
impl<'a> Send for BlockMasks<'a>
impl<'a> Sync for BlockMasks<'a>
impl<'a> Unpin for BlockMasks<'a>
impl<'a> UnsafeUnpin for BlockMasks<'a>
impl<'a> UnwindSafe for BlockMasks<'a>
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more