pub enum Value {
Show 20 variants
Unit,
Bool(bool),
U8(u8),
U16(u16),
U32(u32),
U64(u64),
U128(u128),
I8(i8),
I16(i16),
I32(i32),
I64(i64),
I128(i128),
Group(Group<TestnetV0>),
Field(Field<TestnetV0>),
Scalar(Scalar<TestnetV0>),
Array(Vec<Value>),
Tuple(Vec<Value>),
Address(Address<TestnetV0>),
Future(Future),
Struct(StructContents),
}
Expand description
A Leo value of any type.
Mappings and functions aren’t considered values.
Variants§
Unit
Bool(bool)
U8(u8)
U16(u16)
U32(u32)
U64(u64)
U128(u128)
I8(i8)
I16(i16)
I32(i32)
I64(i64)
I128(i128)
Group(Group<TestnetV0>)
Field(Field<TestnetV0>)
Scalar(Scalar<TestnetV0>)
Array(Vec<Value>)
Tuple(Vec<Value>)
Address(Address<TestnetV0>)
Future(Future)
Struct(StructContents)
Implementations§
Source§impl Value
impl Value
pub fn to_fields(&self) -> Vec<Field<TestnetV0>>
pub fn gte(&self, rhs: &Self) -> Result<bool>
pub fn lte(&self, rhs: &Self) -> Result<bool>
pub fn lt(&self, rhs: &Self) -> Result<bool>
pub fn gt(&self, rhs: &Self) -> Result<bool>
pub fn neq(&self, rhs: &Self) -> Result<bool>
Sourcepub fn eq(&self, rhs: &Self) -> Result<bool>
pub fn eq(&self, rhs: &Self) -> Result<bool>
Are the values equal, according to SnarkVM?
We use this rather than the Eq trait so we can fail when comparing values of different types, rather than just returning false.
pub fn inc_wrapping(&self) -> Self
Sourcepub fn simple_shl(&self, shift: u32) -> Self
pub fn simple_shl(&self, shift: u32) -> Self
Doesn’t correspond to Aleo’s shl, because it does not fail when set bits are shifted out.
pub fn simple_shr(&self, shift: u32) -> Self
Trait Implementations§
Source§impl ToBits for Value
impl ToBits for Value
Source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
Writes
self
into the given vector as a boolean array in little-endian order.Source§fn write_bits_be(&self, _vec: &mut Vec<bool>)
fn write_bits_be(&self, _vec: &mut Vec<bool>)
Writes
self
into the given vector as a boolean array in big-endian order.§fn to_bits_le(&self) -> Vec<bool>
fn to_bits_le(&self) -> Vec<bool>
Returns
self
as a boolean array in little-endian order.§fn to_bits_be(&self) -> Vec<bool>
fn to_bits_be(&self) -> Vec<bool>
Returns
self
as a boolean array in big-endian order.impl Eq for Value
impl StructuralPartialEq 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 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
Fallible version of [
ToCompactString::to_compact_string()
] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
Converts the given value to a [
CompactString
]. Read more