Struct aob::DynamicNeedle
source · pub struct DynamicNeedle { /* private fields */ }
Expand description
The run-time variant of a Needle
.
Implementations§
source§impl DynamicNeedle
impl DynamicNeedle
sourcepub fn from_ida(pattern: &str) -> Result<DynamicNeedle, Error<'_>>
pub fn from_ida(pattern: &str) -> Result<DynamicNeedle, Error<'_>>
Construct a DynamicNeedle
using an Ida style pattern.
§Syntax
Expects a sequence of byte
or wildcard
separated by whitespace, where:
byte
is exactly 2 hexadecimals (uppercase or lowercase), indicating an exact matchwildcard
is one or two?
characters, indicating a fuzzy match
§Example
let needle = DynamicNeedle::from_ida("78 ? BC").unwrap();
let haystack = [0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE];
let matched = needle.find(&haystack).unwrap();
assert_eq!(&haystack[matched.start()..], [0x78, 0x9A, 0xBC, 0xDE]);
sourcepub fn from_bytes(bytes: &[Option<u8>]) -> DynamicNeedle
pub fn from_bytes(bytes: &[Option<u8>]) -> DynamicNeedle
Contruct a DynamicNeedle
using raw bytes, in plain Rust.
§Syntax
Expects an array of Option<u8>
, where:
Some(_)
indicates an exact matchNone
indicates a fuzzy match
§Example
let needle = DynamicNeedle::from_bytes(&[Some(0x78), None, Some(0xBC)]);
let haystack = [0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC, 0xDE];
let matched = needle.find(&haystack).unwrap();
assert_eq!(&haystack[matched.start()..], [0x78, 0x9A, 0xBC, 0xDE]);
Trait Implementations§
source§impl Clone for DynamicNeedle
impl Clone for DynamicNeedle
source§fn clone(&self) -> DynamicNeedle
fn clone(&self) -> DynamicNeedle
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for DynamicNeedle
impl Debug for DynamicNeedle
Auto Trait Implementations§
impl Freeze for DynamicNeedle
impl RefUnwindSafe for DynamicNeedle
impl !Send for DynamicNeedle
impl !Sync for DynamicNeedle
impl Unpin for DynamicNeedle
impl UnwindSafe for DynamicNeedle
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
§impl<T> Chain<T> for T
impl<T> Chain<T> for T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)