Struct dynasmrt::VecAssembler

source ·
pub struct VecAssembler<R: Relocation> { /* private fields */ }
Expand description

An assembler that assembles into a Vec<u8>, while supporting labels. To support the different types of relocations it requires a base address of the to be assembled code to be specified.

Implementations§

Creates a new VecAssembler, with the specified base address.

Creates a new VecAssembler, with the specified base address. Preallocates vec_capacity bytes to the internal vector, and label_capacity label locations of each type. Allows the user to specify the initial capacity of the internal datastructures. ops_capacity is the amount of bytes preallocated for the assembling buffer. local_labels determines the preallocated space for local labels definitions. global_labels determines the preallocated space for global labels definitions. dynamic_labels determines the preallocated space for dynamic labels definitions. static_references determines the preallocated space for references to local/global labels. dynamic_references determines the preallocated space for references to dynamic labels.

Reserve capacity for at least additional instruction bytes to be inserted

Create a new dynamic label ID

Resolves any relocations emitted to the assembler before this point. If an impossible relocation was specified before this point, returns them here.

Use an UncommittedModifier to alter uncommitted code. This does not allow the user to change labels/relocations.

Provides access to the assemblers internal labels registry

Provides mutable access to the assemblers internal labels registry

Finalizes the VecAssembler, returning the resulting Vec<u8> containing all assembled data. this implicitly commits any relocations beforehand and returns an error if required.

Equivalent of finalize, but allows the VecAssembler’s internal allocations to be reused for the next assembler.

Equivalent of take, but instead of allocating a new vector it simply provides a draining iterator over the internal contents.

Trait Implementations§

Formats the value using the given formatter. Read more
Report the current offset into the assembling target
Push a byte into the assembling target
Push filler until the assembling target end is aligned to the given alignment.
Push a signed byte into the assembling target
Push a signed word into the assembling target
Push a signed doubleword into the assembling target
Push a signed quadword into the assembling target
Push an usigned word into the assembling target
Push an usigned doubleword into the assembling target
Push an usigned quadword into the assembling target
This function is called in when a runtime error has to be generated. It panics.
The relocation info type this assembler uses.
Record the definition of a local label
Record the definition of a global label
Record the definition of a dynamic label
Equivalent of global_reloc, but takes a non-encoded relocation
Equivalent of dynamic_reloc, but takes a non-encoded relocation
Equivalent of forward_reloc, but takes a non-encoded relocation
Equivalent of backward_reloc, but takes a non-encoded relocation
Equivalent of bare_reloc, but takes a non-encoded relocation
Record a relocation spot for a forward reference to a local label
Record a relocation spot for a backward reference to a local label
Record a relocation spot for a reference to a global label
Record a relocation spot for a reference to a dynamic label
Record a relocation spot to an arbitrary target.
Extends a collection with the contents of an iterator. Read more
🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Extends a collection with the contents of an iterator. Read more
🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
🔬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§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.