pub struct CompiledScript {Show 16 fields
pub name: String,
pub id: i32,
pub trigger: String,
pub source_path: String,
pub lookup_key: i32,
pub param_types: Vec<Type>,
pub instructions: Vec<Instruction>,
pub local_table: LocalTable,
pub int_local_count: u16,
pub string_local_count: u16,
pub long_local_count: u16,
pub int_arg_count: u16,
pub string_arg_count: u16,
pub long_arg_count: u16,
pub strings: Vec<Box<str>>,
pub switch_tables: Vec<Box<[(i32, usize)]>>,
}Expand description
Compiled bytecode for a single script.
Fields§
§name: String§id: i32§trigger: String§source_path: String§lookup_key: i32§param_types: Vec<Type>§instructions: Vec<Instruction>§local_table: LocalTable§int_local_count: u16§string_local_count: u16§long_local_count: u16§int_arg_count: u16§string_arg_count: u16§long_arg_count: u16§strings: Vec<Box<str>>§switch_tables: Vec<Box<[(i32, usize)]>>Implementations§
Source§impl CompiledScript
impl CompiledScript
pub fn new(name: String, id: i32) -> Self
pub fn push(&mut self, instruction: Instruction)
Sourcepub fn intern_str(&mut self, value: String) -> u32
pub fn intern_str(&mut self, value: String) -> u32
Add a string payload to the pool and return its Operand::Str index.
Sourcepub fn push_string(&mut self, value: String)
pub fn push_string(&mut self, value: String)
Emit a PushConstantString whose literal is interned into the pool.
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Sourcepub fn patch_jump(&mut self, index: usize, target: usize)
pub fn patch_jump(&mut self, index: usize, target: usize)
Update a jump target at the given instruction index.
Sourcepub fn shrink_to_fit(&mut self)
pub fn shrink_to_fit(&mut self)
Release the spare capacity the growable codegen buffers left behind.
Compiled scripts are immutable after codegen but are held in memory for
the whole pointer-check + write phase, so reclaiming each Vec’s doubling
slack (often 25-50%) meaningfully lowers the resident footprint.
Trait Implementations§
Source§impl Clone for CompiledScript
impl Clone for CompiledScript
Auto Trait Implementations§
impl Forget for CompiledScript
impl Freeze for CompiledScript
impl Move for CompiledScript
impl RefUnwindSafe for CompiledScript
impl Send for CompiledScript
impl Sync for CompiledScript
impl Unpin for CompiledScript
impl UnsafeUnpin for CompiledScript
impl UnwindSafe for CompiledScript
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