Enum SvmLiteralParam  
pub(crate) enum SvmLiteralParam<N>where
    N: Network,{
Show 17 variants
    Address(Address<N>),
    Boolean(Boolean<N>),
    Field(Field<N>),
    Group(Group<N>),
    I8(Integer<N, i8>),
    I16(Integer<N, i16>),
    I32(Integer<N, i32>),
    I64(Integer<N, i64>),
    I128(Integer<N, i128>),
    U8(Integer<N, u8>),
    U16(Integer<N, u16>),
    U32(Integer<N, u32>),
    U64(Integer<N, u64>),
    U128(Integer<N, u128>),
    Scalar(Scalar<N>),
    Signature(Box<Signature<N>>),
    String(StringType<N>),
}Expand description
The literal enum represents all supported types in snarkVM.
Variants§
Address(Address<N>)
The Aleo address type.
Boolean(Boolean<N>)
The boolean type.
Field(Field<N>)
The field type.
Group(Group<N>)
The group type.
I8(Integer<N, i8>)
The 8-bit signed integer type.
I16(Integer<N, i16>)
The 16-bit signed integer type.
I32(Integer<N, i32>)
The 32-bit signed integer type.
I64(Integer<N, i64>)
The 64-bit signed integer type.
I128(Integer<N, i128>)
The 128-bit signed integer type.
U8(Integer<N, u8>)
The 8-bit unsigned integer type.
U16(Integer<N, u16>)
The 16-bit unsigned integer type.
U32(Integer<N, u32>)
The 32-bit unsigned integer type.
U64(Integer<N, u64>)
The 64-bit unsigned integer type.
U128(Integer<N, u128>)
The 128-bit unsigned integer type.
Scalar(Scalar<N>)
The scalar type.
Signature(Box<Signature<N>>)
The signature type.
String(StringType<N>)
The string type.
Implementations§
§impl<N> Literal<N>where
    N: Network,
 
impl<N> Literal<N>where
    N: Network,
pub fn cast(&self, to_type: LiteralType) -> Result<Literal<N>, Error>
pub fn cast(&self, to_type: LiteralType) -> Result<Literal<N>, Error>
Casts the literal to the given literal type.
This method checks that the cast does not lose any bits of information, and returns an error if it does.
The hierarchy of casting is as follows:
- (
Address,Group) <->Field<->Scalar<->Integer<->Boolean Signature(not supported)String(not supported)
Note that casting to left along the hierarchy always preserves information.
§impl<N> Literal<N>where
    N: Network,
 
impl<N> Literal<N>where
    N: Network,
pub fn cast_lossy(&self, to_type: LiteralType) -> Result<Literal<N>, Error>
pub fn cast_lossy(&self, to_type: LiteralType) -> Result<Literal<N>, Error>
Casts the literal to the given literal type, with lossy truncation.
This method makes a best-effort attempt to preserve all bits of information, but it is not guaranteed to do so.
The hierarchy of casting is as follows:
- (
Address,Group) <->Field<->Scalar<->Integer<->Boolean Signature(not supported)String(not supported)
Note that casting to left along the hierarchy always preserves information.
§impl<N> Literal<N>where
    N: Network,
 
impl<N> Literal<N>where
    N: Network,
§impl<N> Literal<N>where
    N: Network,
 
impl<N> Literal<N>where
    N: Network,
pub fn size_in_bits(&self) -> u16
pub fn size_in_bits(&self) -> u16
Returns the number of bits of this literal.
§impl<N> Literal<N>where
    N: Network,
 
impl<N> Literal<N>where
    N: Network,
pub fn size_in_bytes(&self) -> u16
pub fn size_in_bytes(&self) -> u16
Returns the size in bytes of this literal.
Trait Implementations§
§impl<'de, N> Deserialize<'de> for Literal<N>where
    N: Network,
 
impl<'de, N> Deserialize<'de> for Literal<N>where
    N: Network,
§fn deserialize<D>(
    deserializer: D,
) -> Result<Literal<N>, <D as Deserializer<'de>>::Error>where
    D: Deserializer<'de>,
 
fn deserialize<D>(
    deserializer: D,
) -> Result<Literal<N>, <D as Deserializer<'de>>::Error>where
    D: Deserializer<'de>,
Deserializes the literal from a string or bytes.
§impl<N> FromBytes for Literal<N>where
    N: Network,
 
impl<N> FromBytes for Literal<N>where
    N: Network,
§fn read_le<R>(reader: R) -> Result<Literal<N>, Error>where
    R: Read,
 
fn read_le<R>(reader: R) -> Result<Literal<N>, Error>where
    R: Read,
Reads the literal from a buffer.
§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.§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 more§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 more§impl<N> Serialize for Literal<N>where
    N: Network,
 
impl<N> Serialize for Literal<N>where
    N: Network,
§fn serialize<S>(
    &self,
    serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
    S: Serializer,
 
fn serialize<S>(
    &self,
    serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
    S: Serializer,
Serializes the literal into a string or as bytes.
§impl<N> ToBits for &Literal<N>where
    N: Network,
 
impl<N> ToBits for &Literal<N>where
    N: Network,
§fn write_bits_le(&self, vec: &mut Vec<bool>)
 
fn write_bits_le(&self, vec: &mut Vec<bool>)
Returns the little-endian bits of the literal.
§fn write_bits_be(&self, vec: &mut Vec<bool>)
 
fn write_bits_be(&self, vec: &mut Vec<bool>)
Returns the big-endian bits of the literal.
§fn to_bits_le(&self) -> Vec<bool>
 
fn to_bits_le(&self) -> Vec<bool>
self as a boolean array in little-endian order.§fn to_bits_be(&self) -> Vec<bool>
 
fn to_bits_be(&self) -> Vec<bool>
self as a boolean array in big-endian order.§impl<N> ToBits for Literal<N>where
    N: Network,
 
impl<N> ToBits for Literal<N>where
    N: Network,
§fn write_bits_le(&self, vec: &mut Vec<bool>)
 
fn write_bits_le(&self, vec: &mut Vec<bool>)
Returns the little-endian bits of the literal.
§fn write_bits_be(&self, vec: &mut Vec<bool>)
 
fn write_bits_be(&self, vec: &mut Vec<bool>)
Returns the big-endian bits of the literal.
§fn to_bits_le(&self) -> Vec<bool>
 
fn to_bits_le(&self) -> Vec<bool>
self as a boolean array in little-endian order.§fn to_bits_be(&self) -> Vec<bool>
 
fn to_bits_be(&self) -> Vec<bool>
self as a boolean array in big-endian order.impl<N> Eq for Literal<N>where
    N: Network,
Auto Trait Implementations§
impl<N> Freeze for Literal<N>
impl<N> RefUnwindSafe for Literal<N>where
    <N as Environment>::Field: RefUnwindSafe,
    <N as Environment>::Projective: RefUnwindSafe,
    <N as Environment>::Scalar: RefUnwindSafe,
    N: RefUnwindSafe,
impl<N> Send for Literal<N>
impl<N> Sync for Literal<N>
impl<N> Unpin for Literal<N>
impl<N> UnwindSafe for Literal<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,
§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>,
§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
key and return true if they are equal.§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>
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§impl<T> Pointable for T
 
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
    T: ?Sized,
 
impl<T> PolicyExt for Twhere
    T: ?Sized,
§impl<T> ToSmolStr for T
 
impl<T> ToSmolStr for T
fn to_smolstr(&self) -> SmolStr
§impl<T> ToStringFallible for Twhere
    T: Display,
 
impl<T> ToStringFallible for Twhere
    T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
 
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.