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
sourceimpl LabelRegistry
impl LabelRegistry
sourcepub fn new() -> LabelRegistry
pub fn new() -> LabelRegistry
Create a new, empty label registry
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 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_global(
&self,
name: &'static str
) -> Result<AssemblyOffset, DynasmError>
pub fn resolve_global(
&self,
name: &'static str
) -> Result<AssemblyOffset, DynasmError>
Returns the offset at which the global label name
was defined, if one was defined.
sourcepub fn resolve_local(
&self,
name: &'static str
) -> Result<AssemblyOffset, DynasmError>
pub fn resolve_local(
&self,
name: &'static str
) -> Result<AssemblyOffset, DynasmError>
Returns the offset at which the last local label named id
was defined, if one was defined.
Trait Implementations
sourceimpl Clone for LabelRegistry
impl Clone for LabelRegistry
sourcefn clone(&self) -> LabelRegistry
fn clone(&self) -> LabelRegistry
Returns a copy of the value. Read more
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for LabelRegistry
impl Debug for LabelRegistry
sourceimpl Default for LabelRegistry
impl Default for LabelRegistry
sourcefn default() -> LabelRegistry
fn default() -> LabelRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for LabelRegistry
impl Send for LabelRegistry
impl Sync for LabelRegistry
impl Unpin for LabelRegistry
impl UnwindSafe for LabelRegistry
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