pub enum ConstValue {
EmptyTuple,
Byte(u8),
Char(char),
Bool(bool),
Integer(i64),
Float(f64),
String(String),
Bytes(Bytes),
Vec(Vec<ConstValue>),
Tuple(Box<[ConstValue]>),
Object(HashMap<String, ConstValue>),
Option(Option<Box<ConstValue>>),
}
Expand description
A constant value.
Variants§
EmptyTuple
A constant unit.
Byte(u8)
A byte.
Char(char)
A character.
Bool(bool)
A boolean constant value.
Integer(i64)
An integer constant.
Float(f64)
An float constant.
String(String)
A string constant designated by its slot.
Bytes(Bytes)
A byte string.
Vec(Vec<ConstValue>)
A vector of values.
Tuple(Box<[ConstValue]>)
An anonymous tuple.
Object(HashMap<String, ConstValue>)
An anonymous object.
Option(Option<Box<ConstValue>>)
An option.
Implementations§
Source§impl ConstValue
impl ConstValue
Sourcepub fn into_value(self) -> Result<Value>
pub fn into_value(self) -> Result<Value>
Convert into virtual machine value.
We provide this associated method since a constant value can be converted into a value infallibly, which is not captured by the trait otherwise.
Trait Implementations§
Source§impl Debug for ConstValue
impl Debug for ConstValue
Source§impl<'de> Deserialize<'de> for ConstValue
impl<'de> Deserialize<'de> for ConstValue
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl FromValue for ConstValue
impl FromValue for ConstValue
Source§fn from_value(value: Value) -> VmResult<Self>
fn from_value(value: Value) -> VmResult<Self>
Try to convert to the given type, from the given value.
Source§impl Serialize for ConstValue
impl Serialize for ConstValue
Auto Trait Implementations§
impl Freeze for ConstValue
impl RefUnwindSafe for ConstValue
impl Send for ConstValue
impl Sync for ConstValue
impl Unpin for ConstValue
impl UnwindSafe for ConstValue
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