pub struct Value { /* private fields */ }Expand description
A Simplicity value.
Implementations§
Source§impl Value
 
impl Value
Sourcepub fn shallow_clone(&self) -> Self
 
pub fn shallow_clone(&self) -> Self
Make a cheap copy of the value.
Sourcepub fn left(inner: Self, right: Arc<Final>) -> Self
 
pub fn left(inner: Self, right: Arc<Final>) -> Self
Create a left value that wraps the given inner value.
Sourcepub fn right(left: Arc<Final>, inner: Self) -> Self
 
pub fn right(left: Arc<Final>, inner: Self) -> Self
Create a right value that wraps the given inner value.
Sourcepub fn product(left: Self, right: Self) -> Self
 
pub fn product(left: Self, right: Self) -> Self
Create a product value that wraps the given left and right values.
Sourcepub fn compact_len(&self) -> usize
 
pub fn compact_len(&self) -> usize
Return the bit length of the value in compact encoding.
Sourcepub fn padded_len(&self) -> usize
 
pub fn padded_len(&self) -> usize
Return the bit length of the value in padded encoding.
Sourcepub fn is_empty(&self) -> bool
 
pub fn is_empty(&self) -> bool
Check if the value is a nested product of units. In this case, the value contains no information.
Sourcepub fn as_product(&self) -> Option<(&Self, &Self)>
 
pub fn as_product(&self) -> Option<(&Self, &Self)>
Access the inner values of a product value.
Sourcepub fn from_byte_array<const N: usize>(bytes: [u8; N]) -> Self
 
pub fn from_byte_array<const N: usize>(bytes: [u8; N]) -> Self
Sourcepub fn iter_compact(&self) -> impl Iterator<Item = bool> + '_
 
pub fn iter_compact(&self) -> impl Iterator<Item = bool> + '_
Return an iterator over the compact bit encoding of the value.
This encoding is used for writing witness data and for computing IMRs.
Sourcepub fn iter_padded(&self) -> impl Iterator<Item = bool> + '_
 
pub fn iter_padded(&self) -> impl Iterator<Item = bool> + '_
Return an iterator over the padded bit encoding of the value.
This encoding is used to represent the value in the Bit Machine.
Sourcepub fn is_of_type(&self, ty: &Final) -> bool
 
pub fn is_of_type(&self, ty: &Final) -> bool
Check if the value is of the given type.
Source§impl Value
 
impl Value
Sourcepub fn from_compact_bits<I: Iterator<Item = bool>>(
    bits: &mut I,
    ty: &Final,
) -> Result<Self, EarlyEndOfStreamError>
 
pub fn from_compact_bits<I: Iterator<Item = bool>>( bits: &mut I, ty: &Final, ) -> Result<Self, EarlyEndOfStreamError>
Decode a value of the given type from its compact bit encoding.
Sourcepub fn from_padded_bits<I: Iterator<Item = bool>>(
    bits: &mut I,
    ty: &Final,
) -> Result<Self, EarlyEndOfStreamError>
 
pub fn from_padded_bits<I: Iterator<Item = bool>>( bits: &mut I, ty: &Final, ) -> Result<Self, EarlyEndOfStreamError>
Decode a value of the given type from its padded bit encoding.