pub struct Pattern<const ALIGNMENT: usize = 1, const BYTES: usize = DEFAULT_BYTES>{ /* private fields */ }Expand description
A prepared pattern. Allows to search for a given byte sequence in data. Supports masking and alignment requirements.
BYTES determines the LANES size.
Every block of data is processed in chunks of BYTES bytes.
Rust will compile this to other targets without issue, but will use
inner loops for that.
It is also the max length for patterns.
Implementations§
Source§impl<const ALIGNMENT: usize, const BYTES: usize> Pattern<ALIGNMENT, BYTES>
impl<const ALIGNMENT: usize, const BYTES: usize> Pattern<ALIGNMENT, BYTES>
Sourcepub const fn new(pattern: &str) -> Self
pub const fn new(pattern: &str) -> Self
Parse a pattern. Use Pattern::from_str to return an error instead of
panicking.
§Panics
Panics if ParsePatternError is returned.
Sourcepub fn from_slice(bytes: &[u8], mask: u64) -> Self
pub fn from_slice(bytes: &[u8], mask: u64) -> Self
Sourcepub const fn from_str(s: &str) -> Result<Self, ParsePatternError>
pub const fn from_str(s: &str) -> Result<Self, ParsePatternError>
Parses a string to a pattern.
Expected format:
? 1A . B4 ?? e0 .. 5f? and . mark wildcards. Only the first character is checked for
wildcards. 10 .error 00 is equivalent to 10 ? 00.
Trait Implementations§
Auto Trait Implementations§
impl<const ALIGNMENT: usize, const BYTES: usize> Freeze for Pattern<ALIGNMENT, BYTES>
impl<const ALIGNMENT: usize, const BYTES: usize> RefUnwindSafe for Pattern<ALIGNMENT, BYTES>
impl<const ALIGNMENT: usize, const BYTES: usize> Send for Pattern<ALIGNMENT, BYTES>
impl<const ALIGNMENT: usize, const BYTES: usize> Sync for Pattern<ALIGNMENT, BYTES>
impl<const ALIGNMENT: usize, const BYTES: usize> Unpin for Pattern<ALIGNMENT, BYTES>
impl<const ALIGNMENT: usize, const BYTES: usize> UnwindSafe for Pattern<ALIGNMENT, BYTES>
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