pub struct DynamicFuture<N: Network> { /* private fields */ }Expand description
A dynamic future is a fixed-size representation of a future. Like static
Futures, a dynamic future contains a program name, program network, and function name. These
are however represented as Field elements as opposed to Identifiers to
ensure a fixed size. Dynamic futures also store a checksum of the
arguments to the future instead of the arguments themselves. This ensures
that all dynamic futures have a constant size, regardless of the amount of
data they contain.
The checksum is computed as truncate_252(Sha3_256(bits)), where bits is constructed by:
- Prefixing with the number of arguments as a
u8in little-endian bits. - Appending the type-prefixed
to_bits_le()of each argument. - Padding the result to the next multiple of 8 bits.
The 256-bit SHA-3 output is truncated to the field’s data capacity (252 bits) and packed into a field element.
Implementations§
Source§impl<N: Network> DynamicFuture<N>
impl<N: Network> DynamicFuture<N>
Sourcepub fn size_in_bits() -> Result<usize>
pub fn size_in_bits() -> Result<usize>
Returns the number of bits in a dynamic future.
Sourcepub fn size_in_bits_raw() -> Result<usize>
pub fn size_in_bits_raw() -> Result<usize>
Returns the number of raw bits in a dynamic future.
Source§impl<N: Network> DynamicFuture<N>
impl<N: Network> DynamicFuture<N>
Source§impl<N: Network> DynamicFuture<N>
impl<N: Network> DynamicFuture<N>
Sourcepub const fn program_name(&self) -> &Field<N>
pub const fn program_name(&self) -> &Field<N>
Returns the program name.
Sourcepub const fn program_network(&self) -> &Field<N>
pub const fn program_network(&self) -> &Field<N>
Returns the program network.
Sourcepub const fn function_name(&self) -> &Field<N>
pub const fn function_name(&self) -> &Field<N>
Returns the function name.
Trait Implementations§
Source§impl<N: Clone + Network> Clone for DynamicFuture<N>
impl<N: Clone + Network> Clone for DynamicFuture<N>
Source§fn clone(&self) -> DynamicFuture<N>
fn clone(&self) -> DynamicFuture<N>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<N: Network> Debug for DynamicFuture<N>
impl<N: Network> Debug for DynamicFuture<N>
Source§impl<N: Network> Display for DynamicFuture<N>
impl<N: Network> Display for DynamicFuture<N>
Source§impl<N: Network> Equal for DynamicFuture<N>
impl<N: Network> Equal for DynamicFuture<N>
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<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> FromBytes for DynamicFuture<N>
impl<N: Network> FromBytes for DynamicFuture<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> FromStr for DynamicFuture<N>
impl<N: Network> FromStr for DynamicFuture<N>
Source§impl<N: Network> Parser for DynamicFuture<N>
impl<N: Network> Parser for DynamicFuture<N>
Source§fn parse(string: &str) -> ParserResult<'_, Self>
fn parse(string: &str) -> ParserResult<'_, Self>
Parses a string into a dynamic future.
Supports two formats:
- Human-readable:
{ _program_id: foo.aleo, _function_name: bar, _checksum: 0field } - Raw field:
{ _program_name: 0field, _program_network: 0field, _function_name: 0field, _checksum: 0field }
Source§impl<N: Network> PartialEq for DynamicFuture<N>
impl<N: Network> PartialEq for DynamicFuture<N>
Source§impl<N: Network> ToBits for DynamicFuture<N>
impl<N: Network> ToBits for DynamicFuture<N>
Source§fn write_bits_le(&self, vec: &mut Vec<bool>)
fn write_bits_le(&self, vec: &mut Vec<bool>)
Returns the dynamic future 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 dynamic future 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> ToBytes for DynamicFuture<N>
impl<N: Network> ToBytes for DynamicFuture<N>
Source§impl<N: Network> ToFields for DynamicFuture<N>
impl<N: Network> ToFields for DynamicFuture<N>
impl<N: Network> Eq for DynamicFuture<N>
Auto Trait Implementations§
impl<N> Freeze for DynamicFuture<N>
impl<N> RefUnwindSafe for DynamicFuture<N>where
<N as Environment>::Field: RefUnwindSafe,
<N as Environment>::Projective: RefUnwindSafe,
<N as Environment>::Scalar: RefUnwindSafe,
N: RefUnwindSafe,
impl<N> Send for DynamicFuture<N>
impl<N> Sync for DynamicFuture<N>
impl<N> Unpin for DynamicFuture<N>where
<N as Environment>::Field: Unpin,
<N as Environment>::Projective: Unpin,
<N as Environment>::Scalar: Unpin,
N: Unpin,
impl<N> UnsafeUnpin for DynamicFuture<N>
impl<N> UnwindSafe for DynamicFuture<N>where
<N as Environment>::Field: UnwindSafe,
<N as Environment>::Projective: 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<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