Struct smoldot::executor::vm::VirtualMachinePrototype
source · pub struct VirtualMachinePrototype { /* private fields */ }Expand description
Virtual machine ready to start executing a function.
Note: This struct implements
Clone. Cloning aVirtualMachinePrototypeallocates memory necessary for the clone to run.
Implementations§
source§impl VirtualMachinePrototype
impl VirtualMachinePrototype
sourcepub fn new(config: Config<'_>) -> Result<Self, NewErr>
pub fn new(config: Config<'_>) -> Result<Self, NewErr>
Creates a new process state machine from the given module. This method notably allocates the memory necessary for the virtual machine to run.
See the module-level documentation for an explanation of the parameters.
sourcepub fn global_value(&mut self, name: &str) -> Result<u32, GlobalValueErr>
pub fn global_value(&mut self, name: &str) -> Result<u32, GlobalValueErr>
Returns the value of a global that the module exports.
The global variable must be a u32, otherwise an error is returned.
sourcepub fn memory_max_pages(&self) -> Option<HeapPages>
pub fn memory_max_pages(&self) -> Option<HeapPages>
Returns the maximum number of pages that the memory can have.
None if there is no limit.
Trait Implementations§
source§impl Clone for VirtualMachinePrototype
impl Clone for VirtualMachinePrototype
source§fn clone(&self) -> VirtualMachinePrototype
fn clone(&self) -> VirtualMachinePrototype
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for VirtualMachinePrototype
impl Send for VirtualMachinePrototype
impl Sync for VirtualMachinePrototype
impl Unpin for VirtualMachinePrototype
impl !UnwindSafe for VirtualMachinePrototype
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.