Struct aho_corasick::packed::pattern::Pattern
source · pub(crate) struct Pattern<'a>(&'a [u8]);
Expand description
A pattern that is used in packed searching.
Tuple Fields§
§0: &'a [u8]
Implementations§
source§impl<'p> Pattern<'p>
impl<'p> Pattern<'p>
sourcepub(crate) fn low_nybbles(&self, len: usize) -> Box<[u8]>
pub(crate) fn low_nybbles(&self, len: usize) -> Box<[u8]>
Returns the first len
low nybbles from this pattern. If this pattern
is shorter than len
, then this panics.
sourcepub(crate) fn is_prefix(&self, bytes: &[u8]) -> bool
pub(crate) fn is_prefix(&self, bytes: &[u8]) -> bool
Returns true if this pattern is a prefix of the given bytes.
sourcepub(crate) unsafe fn is_prefix_raw(
&self,
start: *const u8,
end: *const u8,
) -> bool
pub(crate) unsafe fn is_prefix_raw( &self, start: *const u8, end: *const u8, ) -> bool
Returns true if this pattern is a prefix of the haystack given by the
raw start
and end
pointers.
§Safety
- It must be the case that
start < end
and that the distance between them is at least equal toV::BYTES
. That is, it must always be valid to do at least an unaligned load ofV
atstart
. - Both
start
andend
must be valid for reads. - Both
start
andend
must point to an initialized value. - Both
start
andend
must point to the same allocated object and must either be in bounds or at most one byte past the end of the allocated object. - Both
start
andend
must be derived from a pointer to the same object. - The distance between
start
andend
must not overflowisize
. - The distance being in bounds must not rely on “wrapping around” the address space.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Pattern<'a>
impl<'a> RefUnwindSafe for Pattern<'a>
impl<'a> Send for Pattern<'a>
impl<'a> Sync for Pattern<'a>
impl<'a> Unpin for Pattern<'a>
impl<'a> UnwindSafe for Pattern<'a>
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