pub struct MiraValue(/* private fields */);Expand description
A compact value understood by the Rust VM.
Numbers are stored inline as f64. Other values use checked tags and a
48-bit payload in a NaN-box. Runtime-owned payloads remain checked handles
into a crate::Runtime arena.
Implementations§
Source§impl MiraValue
impl MiraValue
Sourcepub fn array<T: MiraArray + ?Sized>(value: MiraHandle<T>) -> Self
pub fn array<T: MiraArray + ?Sized>(value: MiraHandle<T>) -> Self
Create a MiraValue representing an array value.
Sourcepub fn as_array(&self) -> Option<MiraHandle<dyn MiraArray>>
pub fn as_array(&self) -> Option<MiraHandle<dyn MiraArray>>
Return the array handle, or None for another value type.
Source§impl MiraValue
impl MiraValue
Sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
Check whether this value is a boolean value.
Sourcepub fn as_boolean(&self) -> Option<bool>
pub fn as_boolean(&self) -> Option<bool>
Return the inline boolean payload, or None for another value type.
Source§impl MiraValue
impl MiraValue
Sourcepub fn function<T: MiraFunction + ?Sized>(value: MiraHandle<T>) -> Self
pub fn function<T: MiraFunction + ?Sized>(value: MiraHandle<T>) -> Self
Create a MiraValue representing a callable function.
Sourcepub fn is_function(&self) -> bool
pub fn is_function(&self) -> bool
Check whether this value is a callable function.
Sourcepub fn as_function(&self) -> Option<MiraHandle<dyn MiraFunction>>
pub fn as_function(&self) -> Option<MiraHandle<dyn MiraFunction>>
Return the function handle, or None for another value type.
Source§impl MiraValue
impl MiraValue
Sourcepub fn module<T: MiraModule + ?Sized>(value: MiraHandle<T>) -> Self
pub fn module<T: MiraModule + ?Sized>(value: MiraHandle<T>) -> Self
Create a MiraValue representing a module value.
Sourcepub fn as_module(&self) -> Option<MiraHandle<dyn MiraModule>>
pub fn as_module(&self) -> Option<MiraHandle<dyn MiraModule>>
Return the module handle, or None for another value type.
Source§impl MiraValue
impl MiraValue
Sourcepub fn record<T: MiraRecord + ?Sized>(value: MiraHandle<T>) -> Self
pub fn record<T: MiraRecord + ?Sized>(value: MiraHandle<T>) -> Self
Create a MiraValue representing a record.
Sourcepub fn as_record(&self) -> Option<MiraHandle<dyn MiraRecord>>
pub fn as_record(&self) -> Option<MiraHandle<dyn MiraRecord>>
Return the record handle, or None for another value type.