pub struct ScriptWriter { /* private fields */ }Expand description
Writes compiled scripts to script.dat and script.idx in the output directory.
Implementations§
Source§impl ScriptWriter
impl ScriptWriter
pub fn new(output_dir: String) -> Self
Sourcepub fn write_all(&self, scripts: &[CompiledScript]) -> Result<()>
pub fn write_all(&self, scripts: &[CompiledScript]) -> Result<()>
Write all compiled scripts to script.dat and script.idx.
File layout is sparse by script.id: the idx has one entry per
slot from 0..max_id; slots without a compiled script write length
0 and contribute no bytes to the dat. The loader (rs-engine)
mirrors this — empty-length slots become no-op Script stubs so
the script at array-index N matches compile-time id N.
Packing contiguously (old behaviour) misaligned runtime array
indices with compile-time ids, so bytecode GOSUB 2405 (intended
chatnpc_page) resolved to chatnpc at runtime — infinite
recursion.
pub fn build_all( &self, scripts: &[CompiledScript], ) -> Result<(Vec<u8>, Vec<u8>)>
Auto Trait Implementations§
impl Freeze for ScriptWriter
impl RefUnwindSafe for ScriptWriter
impl Send for ScriptWriter
impl Sync for ScriptWriter
impl Unpin for ScriptWriter
impl UnsafeUnpin for ScriptWriter
impl UnwindSafe for ScriptWriter
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