pub struct Modifier<'a, R: Relocation> { /* private fields */ }
Expand description
Allows modification of already committed assembly code. Contains an internal cursor
into the emitted assembly, initialized to the start, that can be moved around either with the
goto
function, or just by assembling new code into this Modifier
.
Implementations
sourceimpl<'a, R: Relocation> Modifier<'a, R>
impl<'a, R: Relocation> Modifier<'a, R>
sourcepub fn goto(&mut self, offset: AssemblyOffset)
pub fn goto(&mut self, offset: AssemblyOffset)
Move the modifier cursor to the selected location.
sourcepub fn check(&self, offset: AssemblyOffset) -> Result<(), DynasmError>
pub fn check(&self, offset: AssemblyOffset) -> Result<(), DynasmError>
Check that the modifier cursor has not moved past the specified location.
sourcepub fn check_exact(&self, offset: AssemblyOffset) -> Result<(), DynasmError>
pub fn check_exact(&self, offset: AssemblyOffset) -> Result<(), DynasmError>
Check that the modifier cursor is exactly at the specified location.
Trait Implementations
sourceimpl<'a, R: Debug + Relocation> Debug for Modifier<'a, R>
impl<'a, R: Debug + Relocation> Debug for Modifier<'a, R>
sourceimpl<'a, R: Relocation> DynasmApi for Modifier<'a, R>
impl<'a, R: Relocation> DynasmApi for Modifier<'a, R>
sourcefn offset(&self) -> AssemblyOffset
fn offset(&self) -> AssemblyOffset
Report the current offset into the assembling target
sourcefn align(&mut self, alignment: usize, with: u8)
fn align(&mut self, alignment: usize, with: u8)
Push filler until the assembling target end is aligned to the given alignment.
sourcefn runtime_error(&self, msg: &'static str) -> !
fn runtime_error(&self, msg: &'static str) -> !
This function is called in when a runtime error has to be generated. It panics.
sourceimpl<'a, R: Relocation> DynasmLabelApi for Modifier<'a, R>
impl<'a, R: Relocation> DynasmLabelApi for Modifier<'a, R>
type Relocation = R
type Relocation = R
The relocation info type this assembler uses.
sourcefn local_label(&mut self, name: &'static str)
fn local_label(&mut self, name: &'static str)
Record the definition of a local label
sourcefn global_label(&mut self, name: &'static str)
fn global_label(&mut self, name: &'static str)
Record the definition of a global label
sourcefn dynamic_label(&mut self, id: DynamicLabel)
fn dynamic_label(&mut self, id: DynamicLabel)
Record the definition of a dynamic label
sourcefn global_relocation(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: R
)
fn global_relocation(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: R
)
Equivalent of global_reloc, but takes a non-encoded relocation
sourcefn dynamic_relocation(
&mut self,
id: DynamicLabel,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: R
)
fn dynamic_relocation(
&mut self,
id: DynamicLabel,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: R
)
Equivalent of dynamic_reloc, but takes a non-encoded relocation
sourcefn forward_relocation(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: R
)
fn forward_relocation(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: R
)
Equivalent of forward_reloc, but takes a non-encoded relocation
sourcefn backward_relocation(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: R
)
fn backward_relocation(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: R
)
Equivalent of backward_reloc, but takes a non-encoded relocation
sourcefn bare_relocation(
&mut self,
target: usize,
field_offset: u8,
ref_offset: u8,
kind: R
)
fn bare_relocation(
&mut self,
target: usize,
field_offset: u8,
ref_offset: u8,
kind: R
)
Equivalent of bare_reloc, but takes a non-encoded relocation
sourcefn forward_reloc(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
fn forward_reloc(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
Record a relocation spot for a forward reference to a local label
sourcefn backward_reloc(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
fn backward_reloc(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
Record a relocation spot for a backward reference to a local label
sourcefn global_reloc(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
fn global_reloc(
&mut self,
name: &'static str,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
Record a relocation spot for a reference to a global label
sourcefn dynamic_reloc(
&mut self,
id: DynamicLabel,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
fn dynamic_reloc(
&mut self,
id: DynamicLabel,
target_offset: isize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
Record a relocation spot for a reference to a dynamic label
sourcefn bare_reloc(
&mut self,
target: usize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
fn bare_reloc(
&mut self,
target: usize,
field_offset: u8,
ref_offset: u8,
kind: <Self::Relocation as Relocation>::Encoding
)
Record a relocation spot to an arbitrary target.
sourceimpl<'a, 'b, R: Relocation> Extend<&'b u8> for Modifier<'a, R>
impl<'a, 'b, R: Relocation> Extend<&'b u8> for Modifier<'a, R>
sourcefn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = &'b u8>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = &'b u8>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
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
sourceimpl<'a, R: Relocation> Extend<u8> for Modifier<'a, R>
impl<'a, R: Relocation> Extend<u8> for Modifier<'a, R>
sourcefn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = u8>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = u8>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
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
impl<'a, R> RefUnwindSafe for Modifier<'a, R>where
R: RefUnwindSafe,
impl<'a, R> Send for Modifier<'a, R>where
R: Send,
impl<'a, R> Sync for Modifier<'a, R>where
R: Sync,
impl<'a, R> Unpin for Modifier<'a, R>
impl<'a, R> !UnwindSafe for Modifier<'a, R>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more