open_entry_bindings/
vm_value.rs

1use crate::{string::VMStr, virtual_thread::VThread};
2
3pub enum VMValue {
4    ConstStr(VMStr),
5    VarStr(VMStr),
6    Float(f64),
7}
8
9impl VMValue {
10    #[inline(always)] pub fn from(value: u64, thread: VThread) -> VMValue {
11        unsafe { crate::VMValue__from.unwrap_unchecked()(value, thread) }
12    }
13
14    #[inline(always)] pub fn as_str(&mut self) -> Option<(&mut VMStr, bool)> {
15        unsafe { crate::VMValue__as_str.unwrap_unchecked()(self) }
16    }
17
18    #[inline(always)] pub fn as_f64(&self) -> Option<f64> {
19        unsafe { crate::VMValue__as_f64.unwrap_unchecked()(self) }
20    }
21}