Struct juicebox_asm::Label

source ·
pub struct Label { /* private fields */ }
Expand description

A label which is used as target for jump instructions.

use juicebox_asm::{Asm, Label, Reg64};
use juicebox_asm::insn::{Mov, Jmp};

let mut lbl = Label::new();
let mut asm = Asm::new();

// Skip the mov instruction.
asm.jmp(&mut lbl);
asm.mov(Reg64::rax, Reg64::rax);
asm.bind(&mut lbl);

Panics

Panics if the label is dropped while not yet bound, or having unresolved relocations. This is mainly a safety-guard to detect wrong usage.

Implementations§

source§

impl Label

source

pub fn new() -> Label

Create a new unbound Label.

Trait Implementations§

source§

impl Drop for Label

source§

fn drop(&mut self)

Executes the destructor for this type. Read more
source§

impl Jmp<&mut Label> for Asm

source§

fn jmp(&mut self, op1: &mut Label)

Emit an unconditional jump instruction.
source§

impl Jnz<&mut Label> for Asm

source§

fn jnz(&mut self, op1: &mut Label)

Emit a conditional jump if not zero instruction (ZF = 0).
source§

impl Jz<&mut Label> for Asm

source§

fn jz(&mut self, op1: &mut Label)

Emit a conditional jump if zero instruction (ZF = 1).

Auto Trait Implementations§

§

impl RefUnwindSafe for Label

§

impl Send for Label

§

impl Sync for Label

§

impl Unpin for Label

§

impl UnwindSafe for Label

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

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

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, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

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

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.