pub enum Value<N: Network> {
Plaintext(Plaintext<N>),
Record(Record<N, Plaintext<N>>),
Future(Future<N>),
DynamicRecord(DynamicRecord<N>),
DynamicFuture(DynamicFuture<N>),
}Variants§
Plaintext(Plaintext<N>)
A plaintext value.
Record(Record<N, Plaintext<N>>)
A record value.
Future(Future<N>)
A future.
DynamicRecord(DynamicRecord<N>)
A dynamic record.
DynamicFuture(DynamicFuture<N>)
A dynamic future.
Implementations§
Trait Implementations§
Source§impl<'de, N: Network> Deserialize<'de> for Value<N>
impl<'de, N: Network> Deserialize<'de> for Value<N>
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes the value from a string or bytes.
Source§impl<N: Network> From<&DynamicFuture<N>> for Value<N>
impl<N: Network> From<&DynamicFuture<N>> for Value<N>
Source§fn from(dynamic_future: &DynamicFuture<N>) -> Self
fn from(dynamic_future: &DynamicFuture<N>) -> Self
Initializes the value from a dynamic future.
Source§impl<N: Network> From<&DynamicRecord<N>> for Value<N>
impl<N: Network> From<&DynamicRecord<N>> for Value<N>
Source§fn from(dynamic_record: &DynamicRecord<N>) -> Self
fn from(dynamic_record: &DynamicRecord<N>) -> Self
Initializes the value from a dynamic record.
Source§impl<N: Network> From<DynamicFuture<N>> for Value<N>
impl<N: Network> From<DynamicFuture<N>> for Value<N>
Source§fn from(dynamic_future: DynamicFuture<N>) -> Self
fn from(dynamic_future: DynamicFuture<N>) -> Self
Initializes the value from a dynamic future.
Source§impl<N: Network> From<DynamicRecord<N>> for Value<N>
impl<N: Network> From<DynamicRecord<N>> for Value<N>
Source§fn from(dynamic_record: DynamicRecord<N>) -> Self
fn from(dynamic_record: DynamicRecord<N>) -> Self
Initializes the value from a dynamic record.
Source§impl<N: Network> FromBytes for Value<N>
impl<N: Network> FromBytes for Value<N>
Source§fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
Self from a byte array in little-endian order.Source§fn from_bytes_le_unchecked(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
fn from_bytes_le_unchecked(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
Self::from_bytes_le but avoids costly checks.
This shall only be called when deserializing from a trusted source, such as local storage. Read moreSource§fn read_le_unchecked<R>(reader: R) -> Result<Self, Error>
fn read_le_unchecked<R>(reader: R) -> Result<Self, Error>
Self::read_le but avoids costly checks.
This shall only be called when deserializing from a trusted source, such as local storage. Read moreSource§impl<N: Network> Parser for Value<N>
impl<N: Network> Parser for Value<N>
Source§fn parse(string: &str) -> ParserResult<'_, Self>
fn parse(string: &str) -> ParserResult<'_, Self>
Parses a string into a value.
Source§impl<N: Network> ToBits for Value<N>
impl<N: Network> ToBits for Value<N>
Source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
Returns the stack value as a list of little-endian bits.
Source§fn write_bits_be(&self, vec: &mut Vec<bool>)
fn write_bits_be(&self, vec: &mut Vec<bool>)
Returns the stack value as a list of big-endian bits.
Source§fn to_bits_le(&self) -> Vec<bool>
fn to_bits_le(&self) -> Vec<bool>
self as a boolean array in little-endian order.Source§fn to_bits_be(&self) -> Vec<bool>
fn to_bits_be(&self) -> Vec<bool>
self as a boolean array in big-endian order.Source§impl<N: Network> ToBitsRaw for Value<N>
impl<N: Network> ToBitsRaw for Value<N>
Source§fn write_bits_raw_le(&self, vec: &mut Vec<bool>)
fn write_bits_raw_le(&self, vec: &mut Vec<bool>)
Returns the stack value as a list of little-endian bits (without variant or identifier bits for the plaintext type).
Source§fn write_bits_raw_be(&self, vec: &mut Vec<bool>)
fn write_bits_raw_be(&self, vec: &mut Vec<bool>)
Returns the stack value as a list of big-endian bits (without variant or identifier bits for the plaintext type).
Source§fn to_bits_raw_le(&self) -> Vec<bool>
fn to_bits_raw_le(&self) -> Vec<bool>
self as a boolean array in little-endian order.Source§fn to_bits_raw_be(&self) -> Vec<bool>
fn to_bits_raw_be(&self) -> Vec<bool>
self as a boolean array in big-endian order.Source§impl<N: Network> ToFields for Value<N>
impl<N: Network> ToFields for Value<N>
Source§fn to_fields(&self) -> Result<Vec<Self::Field>>
fn to_fields(&self) -> Result<Vec<Self::Field>>
Returns the stack value as a list of fields.
Each variant encodes its data as follows:
- The variant’s
to_bits_le()produces a bit sequence reflecting its internal structure. - A terminator bit (
true) is appended to mark the end of the data. - The bits are packed into field elements in chunks of
Field::size_in_data_bits().
Cross-variant ambiguity is not a concern because the caller always knows the
expected variant via the ValueType or RegisterType from the program definition,
and only the matching variant’s to_fields() is invoked. Within each variant,
the encoding is unambiguous:
Plaintextuses a 2-bit type tag (Literal=00, Struct=01, Array=10) followed by typed data.Recordstarts with owner visibility, 256-bit owner, and a u32 data-length encoding.Futurestarts with a u16 length-prefixed program ID, then function name and arguments.DynamicRecordis fixed-size (owner + root + nonce + version, 776 bits total).DynamicFutureis fixed-size (4 field elements, 1024 bits total).
type Field = Field<N>
Source§impl<N: Network> ToFieldsRaw for Value<N>
impl<N: Network> ToFieldsRaw for Value<N>
impl<N: Network> Eq for Value<N>
Auto Trait Implementations§
impl<N> !Freeze for Value<N>
impl<N> RefUnwindSafe for Value<N>where
<N as Environment>::Projective: RefUnwindSafe,
<N as Environment>::Field: RefUnwindSafe,
<N as Environment>::Scalar: RefUnwindSafe,
N: RefUnwindSafe,
impl<N> Send for Value<N>
impl<N> Sync for Value<N>
impl<N> Unpin for Value<N>where
<N as Environment>::Projective: Unpin,
<N as Environment>::Field: Unpin,
<N as Environment>::Scalar: Unpin,
N: Unpin,
impl<N> UnsafeUnpin for Value<N>where
<N as Environment>::Projective: UnsafeUnpin,
<N as Environment>::Field: UnsafeUnpin,
<N as Environment>::Scalar: UnsafeUnpin,
impl<N> UnwindSafe for Value<N>where
<N as Environment>::Projective: UnwindSafe,
<N as Environment>::Field: UnwindSafe,
<N as Environment>::Scalar: UnwindSafe,
N: UnwindSafe,
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<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
fn take_from_value<D>(
value: &mut Value,
field: &str,
) -> Result<T, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§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> ⓘ
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> ⓘ
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