#[non_exhaustive]pub enum Value {
U32(u32),
I32(i32),
U64(u64),
Bool(bool),
Bytes(Vec<u8>),
Float(f64),
Array(Vec<Value>),
}Expand description
A concrete value passed into or returned from the reference interpreter.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
U32(u32)
Unsigned 32-bit integer.
I32(i32)
Signed 32-bit integer.
U64(u64)
Unsigned 64-bit integer.
Bool(bool)
Boolean value.
Bytes(Vec<u8>)
Raw little-endian storage bytes.
Float(f64)
Floating-point value represented with stable host bits.
Array(Vec<Value>)
Fixed-size array of values.
Implementations§
Source§impl Value
impl Value
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Return this value as little-endian bytes for buffer initialization.
Sourcepub fn to_bytes_width(&self, declared_width: usize) -> Vec<u8> ⓘ
pub fn to_bytes_width(&self, declared_width: usize) -> Vec<u8> ⓘ
Return this value encoded at the declared input width.
Sourcepub fn try_as_u32(&self) -> Option<u32>
pub fn try_as_u32(&self) -> Option<u32>
Try to interpret the value as the IR’s scalar u32 word.
Sourcepub fn try_as_u64(&self) -> Option<u64>
pub fn try_as_u64(&self) -> Option<u64>
Try to interpret the value as a full u64.
Sourcepub fn wide_bytes(&self) -> Vec<u8> ⓘ
pub fn wide_bytes(&self) -> Vec<u8> ⓘ
Return the full value payload as little-endian bytes.
Sourcepub fn try_zero_for(ty: DataType) -> Option<Self>
pub fn try_zero_for(ty: DataType) -> Option<Self>
Try to create a zero value for the given data type.
Trait Implementations§
impl Eq for Value
Auto Trait Implementations§
impl Freeze for Value
impl RefUnwindSafe for Value
impl Send for Value
impl Sync for Value
impl Unpin for Value
impl UnsafeUnpin 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