Struct dynasmrt::components::LabelRegistry
source · pub struct LabelRegistry { /* private fields */ }
Expand description
A registry of labels. Contains all necessessities for keeping track of dynasm labels. This is useful when implementing your own assembler and can also be used to query assemblers for the offsets of labels.
Implementations§
source§impl LabelRegistry
impl LabelRegistry
sourcepub fn new() -> LabelRegistry
pub fn new() -> LabelRegistry
Create a new, empty label registry
sourcepub fn with_capacity(
locals: usize,
globals: usize,
dynamics: usize,
) -> LabelRegistry
pub fn with_capacity( locals: usize, globals: usize, dynamics: usize, ) -> LabelRegistry
Create a new, empty label registry with capacity
space for each different label type.
sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clears the internal contents of this label registry, while maintaining the backing allocations.
sourcepub fn new_dynamic_label(&mut self) -> DynamicLabel
pub fn new_dynamic_label(&mut self) -> DynamicLabel
Create a new dynamic label id
sourcepub fn define_dynamic(
&mut self,
id: DynamicLabel,
offset: AssemblyOffset,
) -> Result<(), DynasmError>
pub fn define_dynamic( &mut self, id: DynamicLabel, offset: AssemblyOffset, ) -> Result<(), DynasmError>
Define a the dynamic label id
to be located at offset
.
sourcepub fn define_global(
&mut self,
name: &'static str,
offset: AssemblyOffset,
) -> Result<(), DynasmError>
pub fn define_global( &mut self, name: &'static str, offset: AssemblyOffset, ) -> Result<(), DynasmError>
Define a the global label name
to be located at offset
.
sourcepub fn define_local(&mut self, name: &'static str, offset: AssemblyOffset)
pub fn define_local(&mut self, name: &'static str, offset: AssemblyOffset)
Define a the local label name
to be located at offset
.
sourcepub fn place_local_reference(&self, name: &'static str) -> Option<StaticLabel>
pub fn place_local_reference(&self, name: &'static str) -> Option<StaticLabel>
Turns a local label into a static label, by adding some extra information to it so we know what local label it is even after another has been defined
sourcepub fn resolve_dynamic(
&self,
id: DynamicLabel,
) -> Result<AssemblyOffset, DynasmError>
pub fn resolve_dynamic( &self, id: DynamicLabel, ) -> Result<AssemblyOffset, DynasmError>
Returns the offset at which the dynamic label id
was defined, if one was defined.
sourcepub fn resolve_static(
&self,
label: &StaticLabel,
) -> Result<AssemblyOffset, DynasmError>
pub fn resolve_static( &self, label: &StaticLabel, ) -> Result<AssemblyOffset, DynasmError>
Returns the offset at which the global label label
was defined, if one was defined.
Trait Implementations§
source§impl Clone for LabelRegistry
impl Clone for LabelRegistry
source§fn clone(&self) -> LabelRegistry
fn clone(&self) -> LabelRegistry
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for LabelRegistry
impl Debug for LabelRegistry
source§impl Default for LabelRegistry
impl Default for LabelRegistry
source§fn default() -> LabelRegistry
fn default() -> LabelRegistry
Auto Trait Implementations§
impl Freeze for LabelRegistry
impl RefUnwindSafe for LabelRegistry
impl Send for LabelRegistry
impl Sync for LabelRegistry
impl Unpin for LabelRegistry
impl UnwindSafe for LabelRegistry
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
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)
clone_to_uninit
)