Struct ruwren::VM

source ·
pub struct VM {
    pub vm: *mut WrenVM,
    /* private fields */
}

Fields§

§vm: *mut WrenVM

Implementations§

source§

impl VM

source

pub fn ensure_slots(&self, count: usize)

source

pub fn get_slot_count(&self) -> usize

source

pub fn set_slot_bool(&self, slot: SlotId, val: bool)

source

pub fn set_slot_double(&self, slot: SlotId, val: f64)

source

pub fn set_slot_null(&self, slot: SlotId)

source

pub fn set_slot_bytes(&self, slot: SlotId, bytes: &[u8])

source

pub fn set_slot_string<S: AsRef<str>>(&self, slot: SlotId, string: S)

source

pub fn get_slot_bool(&self, slot: SlotId) -> Option<bool>

source

pub fn get_slot_double(&self, slot: SlotId) -> Option<f64>

source

pub fn get_slot_bytes(&self, slot: SlotId) -> Option<Vec<u8>>

source

pub fn get_slot_string(&self, slot: SlotId) -> Option<String>

source

pub fn get_slot_type(&self, slot: SlotId) -> SlotType

source

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

source

pub fn has_variable<M: AsRef<str>, N: AsRef<str>>( &self, module: M, name: N ) -> bool

source

pub fn has_module<M: AsRef<str>>(&self, module: M) -> bool

source

pub fn set_slot_new_list(&self, slot: SlotId)

source

pub fn get_list_count(&self, slot: SlotId) -> Option<usize>

source

pub fn insert_in_list( &self, list_slot: SlotId, index: i32, element_slot: SlotId )

source

pub fn get_list_element( &self, list_slot: SlotId, index: i32, element_slot: SlotId )

source

pub fn set_list_element( &self, list_slot: SlotId, index: i32, element_slot: SlotId )

source

pub fn set_slot_new_map(&self, slot: SlotId)

source

pub fn get_map_count(&self, slot: SlotId) -> Option<usize>

source

pub fn get_map_contains_key( &self, map_slot: SlotId, key_slot: SlotId ) -> Option<bool>

source

pub fn get_map_value( &self, map_slot: SlotId, key_slot: SlotId, value_slot: SlotId )

source

pub fn set_map_value( &self, map_slot: SlotId, key_slot: SlotId, value_slot: SlotId )

source

pub fn remove_map_value( &self, map_slot: SlotId, key_slot: SlotId, removed_value_slot: SlotId )

source

pub fn get_slot_foreign<T: 'static + ClassObject>( &self, slot: SlotId ) -> Option<&T>

source

pub fn get_slot_foreign_mut<T: 'static + ClassObject>( &self, slot: SlotId ) -> Option<&mut T>

source

pub fn use_class<T: ForeignItem + 'static, F, O>(&self, f: F) -> O
where F: FnOnce(&VM, Option<&T::Class>) -> O,

Accesses the Foreign V2 class immutably for a given type, if it exists (initialize it if it doesn’t)

source

pub fn use_class_mut<T: ForeignItem + 'static, F, O>(&self, f: F) -> O
where F: FnOnce(&VM, Option<&mut T::Class>) -> O,

Accesses the Foreign V2 class for a given type, if it exists (initialize it if it doesn’t)

source

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.

source

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.

source

pub fn abort_fiber(&self, slot: SlotId)

source

pub fn get_version_number(&self) -> i32

Trait Implementations§

source§

impl Debug for VM

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Drop for VM

source§

fn drop(&mut self)

Executes the destructor for this type. Read more

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.