pub enum Value {
I32(i32),
I64(i64),
U32(u32),
U64(u64),
String(Box<String>),
F64(f64),
Function(Box<Function>),
NativeFunction(Box<NativeFunction>),
F32(f32),
Boolean(bool),
Unit(()),
}
Expand description
Values that can be stored in the bytecode and manipulated by the VM
Variants§
I32(i32)
32-bit signed integer
I64(i64)
64-bit signed integer
U32(u32)
32-bit unsigned integer
U64(u64)
64-bit unsigned integer
String(Box<String>)
String value
F64(f64)
64-bit floating point
Function(Box<Function>)
Function value
NativeFunction(Box<NativeFunction>)
Native function value
F32(f32)
32-bit floating point
Boolean(bool)
Boolean value
Unit(())
Unit value (similar to Rust’s ())
Implementations§
Source§impl Value
impl Value
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Check if the value is numeric (integer or float)
Sourcepub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Check if the value is an integer type
Sourcepub fn is_signed_integer(&self) -> bool
pub fn is_signed_integer(&self) -> bool
Check if the value is a signed integer
Sourcepub fn is_unsigned_integer(&self) -> bool
pub fn is_unsigned_integer(&self) -> bool
Check if the value is an unsigned integer
Sourcepub fn is_boolean(&self) -> bool
pub fn is_boolean(&self) -> bool
Check if the value is a boolean
Trait Implementations§
Source§impl ArithmeticOps for Value
impl ArithmeticOps for Value
Source§fn add(&self, other: &Self) -> Result<Value, String>
fn add(&self, other: &Self) -> Result<Value, String>
Adds two values and returns the result. Read more
Source§fn subtract(&self, other: &Self) -> Result<Value, String>
fn subtract(&self, other: &Self) -> Result<Value, String>
Subtracts one value from another and returns the result. Read more
Source§fn multiply(&self, other: &Self) -> Result<Value, String>
fn multiply(&self, other: &Self) -> Result<Value, String>
Multiplies two values and returns the result. Read more
Source§impl ComparisonOps for Value
impl ComparisonOps for Value
Source§fn equal(&self, other: &Self) -> Result<Value, String>
fn equal(&self, other: &Self) -> Result<Value, String>
Tests if two values are equal. Read more
Source§fn not_equal(&self, other: &Self) -> Result<Value, String>
fn not_equal(&self, other: &Self) -> Result<Value, String>
Tests if two values are not equal. Read more
Source§fn less_than(&self, other: &Self) -> Result<Value, String>
fn less_than(&self, other: &Self) -> Result<Value, String>
Tests if one value is less than another. Read more
Source§fn less_than_equal(&self, other: &Self) -> Result<Value, String>
fn less_than_equal(&self, other: &Self) -> Result<Value, String>
Tests if one value is less than or equal to another. Read more
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnwindSafe for Value
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