pub struct Vm { /* private fields */ }Expand description
A unique struct containing the processors and VM context.
Implementations§
Source§impl Vm
impl Vm
Sourcepub fn load_instructions(
&mut self,
instructions: Vec<Box<dyn Execute>>,
) -> Result<(), Error>
pub fn load_instructions( &mut self, instructions: Vec<Box<dyn Execute>>, ) -> Result<(), Error>
Moves the given Instruction slice into VmCtx memory.
§Example
use vm::Vm;
let mut vm_inst = Vm::new();
let instructions = Vec::from([/* ... */]);
_ = vm_inst.load_instructions(instructions);§Errors
When the VmCtx.instructions is poisoned, InstructionsPoisoned is returned.
Sourcepub fn new_processor(&mut self) -> usize
pub fn new_processor(&mut self) -> usize
Sourcepub fn destroy_processor(&mut self, index: usize)
pub fn destroy_processor(&mut self, index: usize)
Destroys the processor at the given index.
§Example
use vm::Vm;
let mut vm_inst = Vm::new();
let mut prod_idx = vm_inst.new_processor();
vm_inst.destroy_processor(prod_idx);Trait Implementations§
Auto Trait Implementations§
impl Freeze for Vm
impl RefUnwindSafe for Vm
impl !Send for Vm
impl !Sync for Vm
impl Unpin for Vm
impl UnwindSafe for Vm
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