Skip to main content

MiraHandle

Struct MiraHandle 

Source
pub struct MiraHandle<T: Any + ?Sized> { /* private fields */ }
Expand description

A compact, runtime-checked handle to an arena-managed value.

Implementations§

Source§

impl<T: MiraArray + ?Sized> MiraHandle<T>

Source

pub const fn erase_array(self) -> MiraHandle<dyn MiraArray>

Erase the concrete Rust type while preserving its MiraScript category.

Source§

impl<T: MiraRecord + ?Sized> MiraHandle<T>

Source

pub const fn erase_record(self) -> MiraHandle<dyn MiraRecord>

Erase the concrete Rust type while preserving its MiraScript category.

Source§

impl<T: MiraFunction + ?Sized> MiraHandle<T>

Source

pub const fn erase_function(self) -> MiraHandle<dyn MiraFunction>

Erase the concrete Rust type while preserving its MiraScript category.

Source§

impl<T: MiraModule + ?Sized> MiraHandle<T>

Source

pub const fn erase_module(self) -> MiraHandle<dyn MiraModule>

Erase the concrete Rust type while preserving its MiraScript category.

Source§

impl MiraHandle<dyn MiraArray>

Source

pub fn len(self, runtime: &Runtime) -> Result<usize>

Return the number of elements in the array.

Source

pub fn get(self, runtime: &mut Runtime, index: usize) -> Result<MiraValue>

Read one element by index of the array.

Source§

impl MiraHandle<dyn MiraFunction>

Source

pub fn call( self, runtime: &mut Runtime, args: &[MiraValue], ) -> Result<MiraValue>

Invoke the function.

Source§

impl MiraHandle<dyn MiraModule>

Source

pub fn len(self, runtime: &Runtime) -> Result<usize>

Return the number of exports in the module.

Source

pub fn index_of(self, runtime: &Runtime, key: &str) -> Result<Option<usize>>

Find an export’s iteration index of the module.

Source

pub fn key(self, runtime: &Runtime, index: usize) -> Result<&str>

Read one export name by iteration index of the module.

Source

pub fn get(self, runtime: &mut Runtime, index: usize) -> Result<MiraValue>

Read one export value by iteration index of the module.

Source§

impl MiraHandle<dyn MiraRecord>

Source

pub fn len(self, runtime: &Runtime) -> Result<usize>

Return the number of fields in the record.

Source

pub fn index_of(self, runtime: &Runtime, key: &str) -> Result<Option<usize>>

Find a field’s iteration index of the record.

Source

pub fn index_of_i(self, runtime: &Runtime, key: u32) -> Result<Option<usize>>

Find an integer field key’s iteration index of the record without allocating when possible.

Source

pub fn key(self, runtime: &Runtime, index: usize) -> Result<&str>

Read one field key by iteration index of the record.

Source

pub fn get(self, runtime: &mut Runtime, index: usize) -> Result<MiraValue>

Read one field by iteration index of the record.

Trait Implementations§

Source§

impl<T: Any + ?Sized> Clone for MiraHandle<T>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Any + ?Sized> Copy for MiraHandle<T>

Source§

impl<T: Any + ?Sized> Debug for MiraHandle<T>

Source§

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

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

impl<T: Any + ?Sized> Eq for MiraHandle<T>

Source§

impl From<MiraHandle<String>> for MiraValue

Source§

fn from(value: MiraHandle<String>) -> Self

Converts to this type from the input type.
Source§

impl From<MiraHandle<dyn MiraArray>> for MiraValue

Source§

fn from(value: MiraHandle<dyn MiraArray>) -> Self

Converts to this type from the input type.
Source§

impl From<MiraHandle<dyn MiraFunction>> for MiraValue

Source§

fn from(value: MiraHandle<dyn MiraFunction>) -> Self

Converts to this type from the input type.
Source§

impl From<MiraHandle<dyn MiraModule>> for MiraValue

Source§

fn from(value: MiraHandle<dyn MiraModule>) -> Self

Converts to this type from the input type.
Source§

impl From<MiraHandle<dyn MiraRecord>> for MiraValue

Source§

fn from(value: MiraHandle<dyn MiraRecord>) -> Self

Converts to this type from the input type.
Source§

impl<T: Any + ?Sized> Hash for MiraHandle<T>

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<T: Any + ?Sized> PartialEq for MiraHandle<T>

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

Auto Trait Implementations§

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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.