Skip to main content

MiraAny

Enum MiraAny 

Source
pub enum MiraAny {
    Nil,
    Boolean(bool),
    Number(f64),
    String(String),
    Array(Vec<MiraAny>),
    Record(IndexMap<String, MiraAny>),
    Function(MiraFunction),
    Module(MiraModule),
    Extern(Rc<dyn ExternObject>),
    // some variants omitted
}
Expand description

A value understood by the Rust VM.

Variants§

§

Nil

The MiraScript nil value.

§

Boolean(bool)

A boolean value.

§

Number(f64)

A double-precision numeric value.

§

String(String)

An owned UTF-8 string.

§

Array(Vec<MiraAny>)

An owned MiraScript array.

§

Record(IndexMap<String, MiraAny>)

An owned MiraScript record with insertion-ordered keys.

§

Function(MiraFunction)

A callable native or script function.

§

Module(MiraModule)

A native or execution-scoped module.

§

Extern(Rc<dyn ExternObject>)

A live, mutable Rust extern value.

Implementations§

Source§

impl MiraAny

Source

pub fn type_name(&self) -> &'static str

Return the MiraScript type name for this value.

Source

pub fn from_record<T: MiraRecord>(value: T) -> Self

Wrap a Rust record in a new MiraShared allocation.

Source

pub fn from_record_shared<T: MiraRecord>(value: MiraShared<T>) -> Self

Wrap an existing shared Rust record as a live read-only view.

Source

pub fn from_array<T: MiraArray>(value: T) -> Self

Wrap a Rust array in a new MiraShared allocation.

Source

pub fn from_array_shared<T: MiraArray>(value: MiraShared<T>) -> Self

Wrap an existing shared Rust array as a live read-only view.

Source

pub fn from_extern<T: MiraExtern>(value: T) -> Self

Wrap a Rust extern in a new MiraShared allocation.

Source

pub fn from_extern_shared<T: MiraExtern>(value: MiraShared<T>) -> Self

Wrap an existing shared Rust extern as a live mutable object.

Source

pub fn is_initialized(&self) -> bool

Return whether this value is initialized and safe to expose to host code.

Trait Implementations§

Source§

impl Clone for MiraAny

Source§

fn clone(&self) -> MiraAny

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 Debug for MiraAny

Source§

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

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

impl Default for MiraAny

Source§

fn default() -> MiraAny

Returns the “default value” for a type. Read more
Source§

impl From<&str> for MiraAny

Source§

fn from(value: &str) -> Self

Converts to this type from the input type.
Source§

impl From<()> for MiraAny

Source§

fn from(_: ()) -> Self

Converts to this type from the input type.
Source§

impl<K, T> From<BTreeMap<K, T>> for MiraAny
where K: Into<String> + Ord, T: Into<MiraAny>,

Source§

fn from(value: BTreeMap<K, T>) -> Self

Converts to this type from the input type.
Source§

impl<K, T, S> From<HashMap<K, T, S>> for MiraAny
where K: Into<String> + Eq + Hash, T: Into<MiraAny>, S: BuildHasher,

Source§

fn from(value: HashMap<K, T, S>) -> Self

Converts to this type from the input type.
Source§

impl<T: Into<MiraAny>> From<IndexMap<String, T>> for MiraAny

Source§

fn from(value: IndexMap<String, T>) -> Self

Converts to this type from the input type.
Source§

impl From<MiraModule> for MiraAny

Source§

fn from(value: MiraModule) -> Self

Converts to this type from the input type.
Source§

impl From<MiraNativeFn> for MiraAny

Source§

fn from(value: MiraNativeFn) -> Self

Converts to this type from the input type.
Source§

impl<T: MiraBridge> From<MiraShared<T>> for MiraAny

Source§

fn from(value: MiraShared<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Into<MiraAny>> From<Option<T>> for MiraAny

Source§

fn from(value: Option<T>) -> Self

Converts to this type from the input type.
Source§

impl From<String> for MiraAny

Source§

fn from(value: String) -> Self

Converts to this type from the input type.
Source§

impl<T: Into<MiraAny>> From<Vec<T>> for MiraAny

Source§

fn from(value: Vec<T>) -> Self

Converts to this type from the input type.
Source§

impl<T: Into<MiraAny>, const N: usize> From<[T; N]> for MiraAny

Source§

fn from(value: [T; N]) -> Self

Converts to this type from the input type.
Source§

impl From<bool> for MiraAny

Source§

fn from(value: bool) -> Self

Converts to this type from the input type.
Source§

impl From<f32> for MiraAny

Source§

fn from(value: f32) -> Self

Converts to this type from the input type.
Source§

impl From<f64> for MiraAny

Source§

fn from(value: f64) -> Self

Converts to this type from the input type.
Source§

impl From<i8> for MiraAny

Source§

fn from(value: i8) -> Self

Converts to this type from the input type.
Source§

impl From<i16> for MiraAny

Source§

fn from(value: i16) -> Self

Converts to this type from the input type.
Source§

impl From<i32> for MiraAny

Source§

fn from(value: i32) -> Self

Converts to this type from the input type.
Source§

impl From<i64> for MiraAny

Source§

fn from(value: i64) -> Self

Converts to this type from the input type.
Source§

impl From<isize> for MiraAny

Source§

fn from(value: isize) -> Self

Converts to this type from the input type.
Source§

impl From<u8> for MiraAny

Source§

fn from(value: u8) -> Self

Converts to this type from the input type.
Source§

impl From<u16> for MiraAny

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl From<u32> for MiraAny

Source§

fn from(value: u32) -> Self

Converts to this type from the input type.
Source§

impl From<u64> for MiraAny

Source§

fn from(value: u64) -> Self

Converts to this type from the input type.
Source§

impl From<usize> for MiraAny

Source§

fn from(value: usize) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for MiraAny

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
Source§

impl TryFrom<MiraAny> for bool

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<MiraAny> for String

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<MiraAny> for Option<T>
where T: TryFrom<MiraAny, Error = MiraError>,

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<MiraAny> for Vec<T>
where T: TryFrom<MiraAny, Error = MiraError>,

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl<T, const N: usize> TryFrom<MiraAny> for [T; N]
where T: TryFrom<MiraAny, Error = MiraError>,

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl<T> TryFrom<MiraAny> for IndexMap<String, T>
where T: TryFrom<MiraAny, Error = MiraError>,

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<MiraAny> for u8

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<MiraAny> for u16

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<MiraAny> for u32

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<MiraAny> for u64

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<MiraAny> for usize

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<MiraAny> for i8

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<MiraAny> for i16

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<MiraAny> for i32

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<MiraAny> for i64

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<MiraAny> for isize

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<MiraAny> for f64

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.
Source§

impl TryFrom<MiraAny> for f32

Source§

type Error = MiraError

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

fn try_from(value: MiraAny) -> Result<Self>

Performs the conversion.

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<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 = 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>,

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.