pub struct BinaryMatcher<'a, S: Stack<u32> = StaticStack<0x10, u32>, C: Stack<usize> = StaticStack<0x10, usize>> { /* private fields */ }Expand description
The BinaryMatcher is responsible for searching a BinaryPattern within a MatchTarget.
Use BinaryMatcher::next_match to iterate through matches of the specified pattern.
Implementations§
Source§impl<'a> BinaryMatcher<'a>
impl<'a> BinaryMatcher<'a>
Sourcepub fn new(pattern: &'a dyn BinaryPattern, target: &'a dyn MatchTarget) -> Self
pub fn new(pattern: &'a dyn BinaryPattern, target: &'a dyn MatchTarget) -> Self
Create a new BinaryMatcher instance with a statically allocated stack. The default stack size is 0x10 for the save and cursor stack.
Sourcepub fn new_with_heap_stack(
pattern: &'a dyn BinaryPattern,
target: &'a dyn MatchTarget,
) -> BinaryMatcher<'a, HeapStack<u32>, HeapStack<usize>>
pub fn new_with_heap_stack( pattern: &'a dyn BinaryPattern, target: &'a dyn MatchTarget, ) -> BinaryMatcher<'a, HeapStack<u32>, HeapStack<usize>>
Create a new BinaryMatcher instance with a heap allocated save and cursor stack
Source§impl<'a, S: Stack<u32>, C: Stack<usize>> BinaryMatcher<'a, S, C>
impl<'a, S: Stack<u32>, C: Stack<usize>> BinaryMatcher<'a, S, C>
Sourcepub fn new_with_stack(
pattern: &'a dyn BinaryPattern,
target: &'a dyn MatchTarget,
save_stack: S,
cursor_stack: C,
) -> Self
pub fn new_with_stack( pattern: &'a dyn BinaryPattern, target: &'a dyn MatchTarget, save_stack: S, cursor_stack: C, ) -> Self
Create a new binary matcher and supply the save and cursor stacks on your own
Sourcepub fn next_match(&mut self) -> Option<&[u32]>
pub fn next_match(&mut self) -> Option<&[u32]>
Finds the next match for the associated BinaryPattern within the MatchTarget.
§Returns
Some(&[u32])containing the saved stack. The first element of the saved stack represents the start of the matched location.
Subsequent elements can be pushed using theAtom::SaveCursoratom or the'command within the binary pattern.Noneif no further matches are available.
Sourcepub fn next_match_within<R: RangeBounds<usize>>(
&mut self,
range: R,
) -> Option<&[u32]>
pub fn next_match_within<R: RangeBounds<usize>>( &mut self, range: R, ) -> Option<&[u32]>
Finds the next match for the associated BinaryPattern within the MatchTarget within the given range. The current match offset will be clamped into the given range.
Auto Trait Implementations§
impl<'a, S, C> Freeze for BinaryMatcher<'a, S, C>
impl<'a, S = StaticStack<16, u32>, C = StaticStack<16, usize>> !RefUnwindSafe for BinaryMatcher<'a, S, C>
impl<'a, S = StaticStack<16, u32>, C = StaticStack<16, usize>> !Send for BinaryMatcher<'a, S, C>
impl<'a, S = StaticStack<16, u32>, C = StaticStack<16, usize>> !Sync for BinaryMatcher<'a, S, C>
impl<'a, S, C> Unpin for BinaryMatcher<'a, S, C>
impl<'a, S = StaticStack<16, u32>, C = StaticStack<16, usize>> !UnwindSafe for BinaryMatcher<'a, S, C>
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