pub struct SimpleAssembler {
    pub ops: Vec<u8>,
}
Expand description

An assembler that is purely a Vec<u8>. It doesn’t support labels or architecture-specific directives, but can be used to easily inspect generated code. It is intended to be used in testcases.

Fields§

§ops: Vec<u8>

The assembling buffer.

Implementations§

source§

impl SimpleAssembler

source

pub fn new() -> SimpleAssembler

Creates a new SimpleAssembler, containing an empty Vec.

source

pub fn alter(&mut self) -> UncommittedModifier<'_>

Use an UncommittedModifier to alter uncommitted code.

source

pub fn finalize(self) -> Vec<u8>

Destroys this assembler, returning the Vec<u8> contained within

Trait Implementations§

source§

impl Clone for SimpleAssembler

source§

fn clone(&self) -> SimpleAssembler

Returns a copy 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 SimpleAssembler

source§

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

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

impl DynasmApi for SimpleAssembler

source§

fn offset(&self) -> AssemblyOffset

Report the current offset into the assembling target
source§

fn push(&mut self, byte: u8)

Push a byte into the assembling target
source§

fn align(&mut self, alignment: usize, with: u8)

Push filler until the assembling target end is aligned to the given alignment.
source§

fn push_i8(&mut self, value: i8)

Push a signed byte into the assembling target
source§

fn push_i16(&mut self, value: i16)

Push a signed word into the assembling target
source§

fn push_i32(&mut self, value: i32)

Push a signed doubleword into the assembling target
source§

fn push_i64(&mut self, value: i64)

Push a signed quadword into the assembling target
source§

fn push_u16(&mut self, value: u16)

Push an usigned word into the assembling target
source§

fn push_u32(&mut self, value: u32)

Push an usigned doubleword into the assembling target
source§

fn push_u64(&mut self, value: u64)

Push an usigned quadword into the assembling target
source§

fn runtime_error(&self, msg: &'static str) -> !

This function is called in when a runtime error has to be generated. It panics.
source§

impl<'a> Extend<&'a u8> for SimpleAssembler

source§

fn extend<T>(&mut self, iter: T)where
    T: IntoIterator<Item = &'a u8>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
source§

impl Extend<u8> for SimpleAssembler

source§

fn extend<T>(&mut self, iter: T)where
    T: IntoIterator<Item = u8>,

Extends a collection with the contents of an iterator. Read more
source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

const: unstable · source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

const: unstable · 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 Twhere
    T: Clone,

§

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 Twhere
    U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.