pub struct ChunkBuilder { /* private fields */ }Expand description
A DSL-style builder for constructing bytecode chunks.
Allows fluent construction of bytecode sequences without manually managing jump offsets.
Implementations§
Source§impl ChunkBuilder
impl ChunkBuilder
Sourcepub fn load_global(self, name: &str) -> Self
pub fn load_global(self, name: &str) -> Self
Emit LoadGlobal(name).
Sourcepub fn jump_if_not(self, offset: i32) -> Self
pub fn jump_if_not(self, offset: i32) -> Self
Emit JumpIfNot(offset).
Sourcepub fn make_closure(self, n: u32) -> Self
pub fn make_closure(self, n: u32) -> Self
Emit MakeClosure(n).
Sourcepub fn build(self) -> BytecodeChunk
pub fn build(self) -> BytecodeChunk
Finalize and return the built chunk.
Sourcepub fn current_ip(&self) -> usize
pub fn current_ip(&self) -> usize
Current number of opcodes in the builder.
Auto Trait Implementations§
impl Freeze for ChunkBuilder
impl RefUnwindSafe for ChunkBuilder
impl Send for ChunkBuilder
impl Sync for ChunkBuilder
impl Unpin for ChunkBuilder
impl UnsafeUnpin for ChunkBuilder
impl UnwindSafe for ChunkBuilder
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
Mutably borrows from an owned value. Read more