pub struct VM {
pub vm: *mut WrenVM,
/* private fields */
}
Fields§
§vm: *mut WrenVM
Implementations§
source§impl VM
impl VM
pub fn ensure_slots(&self, count: usize)
pub fn get_slot_count(&self) -> usize
pub fn set_slot_bool(&self, slot: SlotId, val: bool)
pub fn set_slot_double(&self, slot: SlotId, val: f64)
pub fn set_slot_null(&self, slot: SlotId)
pub fn set_slot_bytes(&self, slot: SlotId, bytes: &[u8])
pub fn set_slot_string<S: AsRef<str>>(&self, slot: SlotId, string: S)
pub fn get_slot_bool(&self, slot: SlotId) -> Option<bool>
pub fn get_slot_double(&self, slot: SlotId) -> Option<f64>
pub fn get_slot_bytes(&self, slot: SlotId) -> Option<Vec<u8>>
pub fn get_slot_string(&self, slot: SlotId) -> Option<String>
pub fn get_slot_type(&self, slot: SlotId) -> SlotType
sourcepub fn get_variable<M: AsRef<str>, N: AsRef<str>>(
&self,
module: M,
name: N,
slot: SlotId
) -> bool
pub fn get_variable<M: AsRef<str>, N: AsRef<str>>( &self, module: M, name: N, slot: SlotId ) -> bool
Returns Some(()) if the variable was found and stored in the given slot
Returns None if the variable does not exist
pub fn has_variable<M: AsRef<str>, N: AsRef<str>>( &self, module: M, name: N ) -> bool
pub fn has_module<M: AsRef<str>>(&self, module: M) -> bool
pub fn set_slot_new_list(&self, slot: SlotId)
pub fn get_list_count(&self, slot: SlotId) -> Option<usize>
pub fn insert_in_list( &self, list_slot: SlotId, index: i32, element_slot: SlotId )
pub fn get_list_element( &self, list_slot: SlotId, index: i32, element_slot: SlotId )
pub fn set_list_element( &self, list_slot: SlotId, index: i32, element_slot: SlotId )
pub fn set_slot_new_map(&self, slot: SlotId)
pub fn get_map_count(&self, slot: SlotId) -> Option<usize>
pub fn get_map_contains_key( &self, map_slot: SlotId, key_slot: SlotId ) -> Option<bool>
pub fn get_map_value( &self, map_slot: SlotId, key_slot: SlotId, value_slot: SlotId )
pub fn set_map_value( &self, map_slot: SlotId, key_slot: SlotId, value_slot: SlotId )
pub fn remove_map_value( &self, map_slot: SlotId, key_slot: SlotId, removed_value_slot: SlotId )
pub fn get_slot_foreign<T: 'static + ClassObject>( &self, slot: SlotId ) -> Option<&T>
pub fn get_slot_foreign_mut<T: 'static + ClassObject>( &self, slot: SlotId ) -> Option<&mut T>
sourcepub fn use_class<T: ForeignItem + 'static, F, O>(&self, f: F) -> O
pub fn use_class<T: ForeignItem + 'static, F, O>(&self, f: F) -> O
Accesses the Foreign V2 class immutably for a given type, if it exists (initialize it if it doesn’t)
sourcepub fn use_class_mut<T: ForeignItem + 'static, F, O>(&self, f: F) -> O
pub fn use_class_mut<T: ForeignItem + 'static, F, O>(&self, f: F) -> O
Accesses the Foreign V2 class for a given type, if it exists (initialize it if it doesn’t)
sourcepub fn set_slot_new_foreign<M: AsRef<str>, C: AsRef<str>, T: 'static + ClassObject>(
&self,
module: M,
class: C,
object: T,
slot: SlotId
) -> Result<&mut T, ForeignSendError>
pub fn set_slot_new_foreign<M: AsRef<str>, C: AsRef<str>, T: 'static + ClassObject>( &self, module: M, class: C, object: T, slot: SlotId ) -> Result<&mut T, ForeignSendError>
Looks up the specified module for the given class If it’s type matches with type T, will create a new instance in the given slot
WARNING: This will overwrite slot 0, so be careful.
sourcepub fn set_slot_new_foreign_scratch<M: AsRef<str>, C: AsRef<str>, T: 'static + ClassObject>(
&self,
module: M,
class: C,
object: T,
slot: SlotId,
scratch: SlotId
) -> Result<&mut T, ForeignSendError>
pub fn set_slot_new_foreign_scratch<M: AsRef<str>, C: AsRef<str>, T: 'static + ClassObject>( &self, module: M, class: C, object: T, slot: SlotId, scratch: SlotId ) -> Result<&mut T, ForeignSendError>
Looks up the specified module for the given class If it’s type matches with type T, will create a new instance in the given slot
WARNING: This will overwrite slot scratch
, so be careful.
pub fn abort_fiber(&self, slot: SlotId)
pub fn get_version_number(&self) -> i32
Trait Implementations§
Auto Trait Implementations§
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