Atom

Enum Atom 

Source
pub enum Atom {
Show 26 variants Byte(u8), Save(u8), Push(u8), Pop, Fuzzy(u8), Skip(u8), Back(u8), Rangext(u8), Many(u8), Jump1, Jump4, Ptr, Pir(u8), VTypeName, Check(u8), Aligned(u8), ReadI8(u8), ReadU8(u8), ReadI16(u8), ReadU16(u8), ReadI32(u8), ReadU32(u8), Zero(u8), Case(u8), Break(u8), Nop,
}
Expand description

Pattern atoms.

The scanner will silently ignore nonsensical arguments.

Variants§

§

Byte(u8)

Matches a single byte.

§

Save(u8)

Captures the cursor in the save array at the specified index.

§

Push(u8)

After a Pop later continue matching at the current cursor plus the argument.

§

Pop

Pops the cursor from the stack and continues matching.

§

Fuzzy(u8)

Sets a mask to apply on next byte match.

§

Skip(u8)

Skips a fixed number of bytes.

§

Back(u8)

Rewinds the cursor a fixed number of bytes.

§

Rangext(u8)

Extends the push, skip, back and many range by argument * 256.

§

Many(u8)

Looks for the next pattern at most a certain number of bytes ahead.

§

Jump1

Follows a signed 1 byte jump.

Reads the byte under the cursor, sign extends it, adds it plus 1 to the cursor and continues matching.

§

Jump4

Follows a signed 4 byte jump.

Reads the dword under the cursor and adds it plus 4 to the cursor and continues matching.

§

Ptr

Follows an absolute pointer.

Reads the pointer under the cursor, translates it to an RVA, assigns it to the cursor and continues matching.

Matching fails immediately when translation to an RVA fails.

§

Pir(u8)

Follows a position independent reference.

Reads the dword under the cursor and adds it to the saved cursor for the given slot and continues matching.

§

VTypeName

Given a cursor pointing to the vtable follows it to its type name.

§

Check(u8)

Compares the cursor with the value in the given save slot and fails if they’re not equal.

§

Aligned(u8)

Checks if the cursor is aligned to (1 << value).

§

ReadI8(u8)

Reads and sign-extends the byte under the cursor, writes to the given slot and advances the cursor by 1.

§

ReadU8(u8)

Reads and zero-extends the byte under the cursor, writes to the given slot and advances the cursor by 1.

§

ReadI16(u8)

Reads and sign-extends the word under the cursor, writes to the given slot and advances the cursor by 2.

§

ReadU16(u8)

Reads and zero-extends the word under the cursor, writes to the given slot and advances the cursor by 2.

§

ReadI32(u8)

Reads the dword under the cursor, writes to the given slot and advances the cursor by 4.

§

ReadU32(u8)

Reads the dword under the cursor, writes to the given slot and advances the cursor by 4.

§

Zero(u8)

Writes zero to the given save slot.

§

Case(u8)

Sets a retry point when matching fails.

When matching fails the cursor is restored and matching begins again skipping N atoms.

§

Break(u8)

Continues matching after a case atom, skipping the next N atoms.

§

Nop

Null instruction, used to make the parser easier to write.

Trait Implementations§

Source§

impl Clone for Atom

Source§

fn clone(&self) -> Atom

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Atom

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Atom

Source§

fn eq(&self, other: &Atom) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for Atom

Source§

impl Eq for Atom

Source§

impl StructuralPartialEq for Atom

Auto Trait Implementations§

§

impl Freeze for Atom

§

impl RefUnwindSafe for Atom

§

impl Send for Atom

§

impl Sync for Atom

§

impl Unpin for Atom

§

impl UnwindSafe for Atom

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.