#[non_exhaustive]pub enum Value {
U32(u32),
I32(i32),
U64(u64),
Bool(bool),
Bytes(Arc<[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
U32(u32)
Unsigned 32-bit integer.
I32(i32)
Signed 32-bit integer.
U64(u64)
Unsigned 64-bit integer.
Bool(bool)
Boolean value.
Bytes(Arc<[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 extend_bytes_width(
&self,
declared_width: usize,
out: &mut Vec<u8>,
) -> Result<(), Error>
pub fn extend_bytes_width( &self, declared_width: usize, out: &mut Vec<u8>, ) -> Result<(), Error>
Append this value encoded at the declared input width without allocating a temporary byte vector for the caller.
§Errors
Returns an error if the destination length would overflow.
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 try_as_f32(&self) -> Option<f32>
pub fn try_as_f32(&self) -> Option<f32>
Try to interpret the value as an f32.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.