Halt Method
The halt method is a critical control function used to immediately cease all VM execution. It terminates the current process, preventing any further bytecode instructions from being processed.
Using TypeScript
For TypeScript, invoking the halt method forces the VM to stop instantly. This is useful for emergency shutdowns or when your logic determines that the current execution context is no longer valid.
ts
vm.halt();
vm.run(); // will not be executed
console.log('The VM has been terminated.');Using Rust
In Rust, the halt method provides a direct way to terminate the VM instance. Once called, the VM will stop executing, ensuring that no subsequent instructions or queued tasks are performed.
rust
vm.halt();
vm.run(None); // will not be executed
println!("The VM has been terminated.");INFO
Capability Required: Unsafe