pub struct Vm<'a> {
pub step_limit: u64,
pub steps: u64,
/* private fields */
}Fields§
§step_limit: u64Soft cap to avoid runaway computations in tests.
steps: u64Implementations§
Source§impl<'a> Vm<'a>
impl<'a> Vm<'a>
pub fn new(program: &'a Program) -> Self
pub fn with_handler( program: &'a Program, handler: Box<dyn EffectHandler + 'a>, ) -> Self
pub fn set_tracer(&mut self, tracer: Box<dyn Tracer + 'a>)
Sourcepub fn set_step_limit(&mut self, limit: u64)
pub fn set_step_limit(&mut self, limit: u64)
Cap the number of opcode dispatches before the VM aborts with
step limit exceeded. Useful as a runtime DoS guard against
untrusted code (e.g. the agent-tool sandbox, where an LLM
could emit list.fold(list.range(0, 1_000_000_000), …) to hang
the host). Default is 10_000_000.
pub fn call(&mut self, name: &str, args: Vec<Value>) -> Result<Value, VmError>
pub fn invoke(&mut self, fn_id: u32, args: Vec<Value>) -> Result<Value, VmError>
Auto Trait Implementations§
impl<'a> Freeze for Vm<'a>
impl<'a> !RefUnwindSafe for Vm<'a>
impl<'a> !Send for Vm<'a>
impl<'a> !Sync for Vm<'a>
impl<'a> Unpin for Vm<'a>
impl<'a> UnsafeUnpin for Vm<'a>
impl<'a> !UnwindSafe for Vm<'a>
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