pub struct Pattern { /* private fields */ }Expand description
A pattern that can be used to scan for matches in a byte array.
This is the main type of this crate, and you can create it
using the PatternBuilder struct.
Internally, a pattern is represented as a vector of bytes for the signature, a vector of booleans for the mask, and the number of threads to use.
Implementations§
Source§impl Pattern
impl Pattern
Sourcepub fn get_threads(&self) -> usize
pub fn get_threads(&self) -> usize
§Returns
The number of threads to use in scans of this pattern.
Sourcepub fn scan(
&self,
data: &[u8],
callback: impl FnMut(usize) -> bool + Send + Sync,
) -> bool
pub fn scan( &self, data: &[u8], callback: impl FnMut(usize) -> bool + Send + Sync, ) -> bool
Performs the AOB scan in the given slice.
If specified, this function will split the data into chunks and scan
each chunk in parallel.
§Arguments
data- The data slice to scan.callback- The callback to execute when a match is found.- The callback receives the offset of the match as an argument.
- It should return
trueto continue scanning, orfalseto stop.
§Returns
True if at least one match was found, otherwise false.
Trait Implementations§
Source§impl ObjectScan for Pattern
impl ObjectScan for Pattern
Source§fn scan_object(
&self,
data: &[u8],
section_name: &str,
callback: impl FnMut(SectionResult) -> bool + Send + Sync,
) -> Result<bool, ObjectError>
fn scan_object( &self, data: &[u8], section_name: &str, callback: impl FnMut(SectionResult) -> bool + Send + Sync, ) -> Result<bool, ObjectError>
impl Eq for Pattern
impl StructuralPartialEq for Pattern
Auto Trait Implementations§
impl Freeze for Pattern
impl RefUnwindSafe for Pattern
impl Send for Pattern
impl Sync for Pattern
impl Unpin for Pattern
impl UnwindSafe for Pattern
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