pub struct Chunk {
pub name: String,
pub constants: Vec<Value>,
pub code: Vec<Instruction>,
pub functions: Vec<FunctionDef>,
}Expand description
A compiled unit of Byteflow bytecode: code, constants and the function
table. One Chunk can back many concurrently-running flows — it is
immutable after construction, so it is shared behind an Arc rather than
copied per flow (see crate::Vm).
Fields§
§name: String§constants: Vec<Value>§code: Vec<Instruction>§functions: Vec<FunctionDef>Implementations§
Source§impl Chunk
impl Chunk
pub fn function(&self, index: u32) -> Option<&FunctionDef>
pub fn constant(&self, index: u32) -> Option<&Value>
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of instructions, used by the verifier to bound-check jump targets ahead of time instead of on every branch at runtime.
pub fn is_empty(&self) -> bool
Trait Implementations§
impl StructuralPartialEq for Chunk
Auto Trait Implementations§
impl Forget for Chunk
impl Freeze for Chunkwhere
*const u8 is !null: Freeze,
PhantomData<u8>: Freeze,
PhantomData<Value>: Freeze,
PhantomData<Instruction>: Freeze,
PhantomData<FunctionDef>: Freeze,
impl Move for Chunk
impl RefUnwindSafe for Chunk
impl Send for Chunk
impl Sync for Chunk
impl Unpin for Chunk
impl UnsafeUnpin for Chunkwhere
*const u8 is !null: UnsafeUnpin,
PhantomData<u8>: UnsafeUnpin,
PhantomData<Value>: UnsafeUnpin,
PhantomData<Instruction>: UnsafeUnpin,
PhantomData<FunctionDef>: UnsafeUnpin,
impl UnwindSafe for Chunkwhere
RawVecInner: UnwindSafe,
Arc<Value>: UnwindSafe,
Arc<str>: UnwindSafe,
Arc<[u8]>: UnwindSafe,
Arc<[Value]>: UnwindSafe,
Arc<[(MapKey, Value)]>: UnwindSafe,
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