pub enum VmValue {
Show 18 variants
Int(i64),
Float(f64),
String(Rc<str>),
Bool(bool),
Nil,
List(Rc<Vec<VmValue>>),
Dict(Rc<BTreeMap<String, VmValue>>),
Closure(Rc<VmClosure>),
BuiltinRef(Rc<str>),
Duration(u64),
EnumVariant {
enum_name: String,
variant: String,
fields: Vec<VmValue>,
},
StructInstance {
struct_name: String,
fields: BTreeMap<String, VmValue>,
},
TaskHandle(String),
Channel(VmChannelHandle),
Atomic(VmAtomicHandle),
McpClient(VmMcpClientHandle),
Set(Rc<Vec<VmValue>>),
Generator(VmGenerator),
}Expand description
VM runtime value.
Variants§
Int(i64)
Float(f64)
String(Rc<str>)
Bool(bool)
Nil
List(Rc<Vec<VmValue>>)
Dict(Rc<BTreeMap<String, VmValue>>)
Closure(Rc<VmClosure>)
BuiltinRef(Rc<str>)
Reference to a registered builtin function, used when a builtin name is
referenced as a value (e.g. snake_dict.rekey(snake_to_camel)). The
contained string is the builtin’s registered name.
Duration(u64)
EnumVariant
StructInstance
TaskHandle(String)
Channel(VmChannelHandle)
Atomic(VmAtomicHandle)
McpClient(VmMcpClientHandle)
Set(Rc<Vec<VmValue>>)
Generator(VmGenerator)
Implementations§
Source§impl VmValue
impl VmValue
pub fn is_truthy(&self) -> bool
pub fn type_name(&self) -> &'static str
pub fn display(&self) -> String
Sourcepub fn write_display(&self, out: &mut String)
pub fn write_display(&self, out: &mut String)
Writes the display representation directly into out,
avoiding intermediate Vec
Sourcepub fn as_dict(&self) -> Option<&BTreeMap<String, VmValue>>
pub fn as_dict(&self) -> Option<&BTreeMap<String, VmValue>>
Get the value as a BTreeMap reference, if it’s a Dict.
pub fn as_int(&self) -> Option<i64>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VmValue
impl !RefUnwindSafe for VmValue
impl !Send for VmValue
impl !Sync for VmValue
impl Unpin for VmValue
impl UnsafeUnpin for VmValue
impl !UnwindSafe for VmValue
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more