pub enum Primitive {
Nil,
Bool(bool),
Int(i64),
UInt(u64),
Float(f64),
}Expand description
A primitive virtual machine value.
Variants§
Nil
A value representing nothing.
Bool(bool)
A boolean value.
Int(i64)
A signed 64-bit integer.
UInt(u64)
An unsigned 64-bit integer.
Float(f64)
A double-preceision floating point number.
Implementations§
source§impl Primitive
impl Primitive
sourcepub fn truthy(&self) -> bool
pub fn truthy(&self) -> bool
Returns true if this value should be considered true in a boolean
expression.
sourcepub fn idiv(&self, rhs: &Self) -> Result<Self, Fault>
pub fn idiv(&self, rhs: &Self) -> Result<Self, Fault>
Divides self by rhs, using whole numbers.
sourcepub fn rem(&self, rhs: &Self) -> Result<Self, Fault>
pub fn rem(&self, rhs: &Self) -> Result<Self, Fault>
Calcualtes the remainder of dividing self by rhs using whole
numbers.
sourcepub fn not(&self) -> Result<Self, Fault>
pub fn not(&self) -> Result<Self, Fault>
Returns the inverse of Self::truthy.
sourcepub fn bitwise_not(&self) -> Result<Self, Fault>
pub fn bitwise_not(&self) -> Result<Self, Fault>
Returns the bitwise not of this value.
sourcepub fn bitwise_and(&self, rhs: &Self) -> Result<Self, Fault>
pub fn bitwise_and(&self, rhs: &Self) -> Result<Self, Fault>
Returns the bitwise and of self and rhs.
sourcepub fn bitwise_or(&self, rhs: &Self) -> Result<Self, Fault>
pub fn bitwise_or(&self, rhs: &Self) -> Result<Self, Fault>
Returns the bitwise or of self and rhs.
sourcepub fn bitwise_xor(&self, rhs: &Self) -> Result<Self, Fault>
pub fn bitwise_xor(&self, rhs: &Self) -> Result<Self, Fault>
Returns the bitwise xor of self and rhs.
sourcepub fn shift_left(&self, rhs: &Self) -> Result<Self, Fault>
pub fn shift_left(&self, rhs: &Self) -> Result<Self, Fault>
Returns the bitwise shift left of self by rhs.
sourcepub fn shift_right(&self, rhs: &Self) -> Result<Self, Fault>
pub fn shift_right(&self, rhs: &Self) -> Result<Self, Fault>
Returns the shift right of self by rhs.
sourcepub fn to_string(&self) -> Result<SymbolRef, Fault>
pub fn to_string(&self) -> Result<SymbolRef, Fault>
Returns this value as a shared string reference.
sourcepub fn hash_into(&self, hasher: &mut ValueHasher)
pub fn hash_into(&self, hasher: &mut ValueHasher)
Hashes this value into hasher.
sourcepub fn equals(&self, other: &Self) -> Result<bool, Fault>
pub fn equals(&self, other: &Self) -> Result<bool, Fault>
Returns true if self and other are equivalent values.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Primitive
impl<'de> Deserialize<'de> for Primitive
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>,
impl Copy for Primitive
Auto Trait Implementations§
impl Freeze for Primitive
impl RefUnwindSafe for Primitive
impl Send for Primitive
impl Sync for Primitive
impl Unpin for Primitive
impl UnwindSafe for Primitive
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
§impl<A> Cast for A
impl<A> Cast for A
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)