pub struct IdentifierLiteral<E>where
E: Environment,{ /* private fields */ }Expand description
An identifier literal is an ASCII string (up to SIZE_IN_BYTES bytes) stored as a byte array.
The string content is stored as null-padded bytes in little-endian order.
Syntax: 'hello_world' (single-quoted, no type suffix).
The allowed characters are: [a-zA-Z][a-zA-Z0-9_]*.
Implementations§
Source§impl<E> IdentifierLiteral<E>where
E: Environment,
impl<E> IdentifierLiteral<E>where
E: Environment,
Sourcepub fn new(string: &str) -> Result<IdentifierLiteral<E>, Error>
pub fn new(string: &str) -> Result<IdentifierLiteral<E>, Error>
Creates a new identifier literal from a string.
Allowed characters: [a-zA-Z][a-zA-Z0-9_]*.
Sourcepub fn from_bytes_array(bytes: [u8; 31]) -> Result<IdentifierLiteral<E>, Error>
pub fn from_bytes_array(bytes: [u8; 31]) -> Result<IdentifierLiteral<E>, Error>
Creates an identifier literal from a byte array, validating the contents.
Trait Implementations§
Source§impl<N: Network> Cast<Boolean<N>> for IdentifierLiteral<N>
impl<N: Network> Cast<Boolean<N>> for IdentifierLiteral<N>
Source§fn cast(&self) -> Result<Boolean<N>>
fn cast(&self) -> Result<Boolean<N>>
Casts an IdentifierLiteral to a Boolean.
Note: This cast always fails because valid identifier literals start with
a letter (first byte >= 0x41), which cannot represent a boolean field value
(0 or 1). This implementation exists for uniformity with the impl_cast_body!
macro used by all literal types.
Source§impl<E: Environment> Cast<IdentifierLiteral<E>> for Boolean<E>
impl<E: Environment> Cast<IdentifierLiteral<E>> for Boolean<E>
Source§fn cast(&self) -> Result<IdentifierLiteral<E>>
fn cast(&self) -> Result<IdentifierLiteral<E>>
Casts a Boolean to an IdentifierLiteral.
Note: This cast always fails because valid identifier literals cannot map
to boolean values (0x00 or 0x01). The byte 0x00 is null and 0x01 (SOH) is
not a valid identifier character. This implementation exists for uniformity
with the impl_cast_body! macro used by all literal types.
Source§impl<E: Environment> Cast<IdentifierLiteral<E>> for Field<E>
impl<E: Environment> Cast<IdentifierLiteral<E>> for Field<E>
Source§fn cast(&self) -> Result<IdentifierLiteral<E>>
fn cast(&self) -> Result<IdentifierLiteral<E>>
Casts a Field to an IdentifierLiteral.
Source§impl<E: Environment, I: IntegerType> Cast<IdentifierLiteral<E>> for Integer<E, I>
impl<E: Environment, I: IntegerType> Cast<IdentifierLiteral<E>> for Integer<E, I>
Source§fn cast(&self) -> Result<IdentifierLiteral<E>>
fn cast(&self) -> Result<IdentifierLiteral<E>>
Casts an Integer to an IdentifierLiteral.
Source§impl<E: Environment> Cast<IdentifierLiteral<E>> for Scalar<E>
impl<E: Environment> Cast<IdentifierLiteral<E>> for Scalar<E>
Source§fn cast(&self) -> Result<IdentifierLiteral<E>>
fn cast(&self) -> Result<IdentifierLiteral<E>>
Casts a Scalar to an IdentifierLiteral.
Source§impl<N: Network, I: IntegerType> Cast<Integer<N, I>> for IdentifierLiteral<N>
impl<N: Network, I: IntegerType> Cast<Integer<N, I>> for IdentifierLiteral<N>
Source§impl<N: Network> Cast for IdentifierLiteral<N>
impl<N: Network> Cast for IdentifierLiteral<N>
Source§fn cast(&self) -> Result<IdentifierLiteral<N>>
fn cast(&self) -> Result<IdentifierLiteral<N>>
Casts an IdentifierLiteral to itself.
Source§impl<E> Clone for IdentifierLiteral<E>where
E: Clone + Environment,
impl<E> Clone for IdentifierLiteral<E>where
E: Clone + Environment,
Source§fn clone(&self) -> IdentifierLiteral<E>
fn clone(&self) -> IdentifierLiteral<E>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<E> Debug for IdentifierLiteral<E>where
E: Environment,
impl<E> Debug for IdentifierLiteral<E>where
E: Environment,
Source§impl<'de, E> Deserialize<'de> for IdentifierLiteral<E>where
E: Environment,
impl<'de, E> Deserialize<'de> for IdentifierLiteral<E>where
E: Environment,
Source§fn deserialize<D>(
deserializer: D,
) -> Result<IdentifierLiteral<E>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<IdentifierLiteral<E>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserializes the identifier literal from a string or bytes.
Source§impl<E> Display for IdentifierLiteral<E>where
E: Environment,
impl<E> Display for IdentifierLiteral<E>where
E: Environment,
Source§impl<E> Distribution<IdentifierLiteral<E>> for Standardwhere
E: Environment,
impl<E> Distribution<IdentifierLiteral<E>> for Standardwhere
E: Environment,
Source§fn sample<R>(&self, rng: &mut R) -> IdentifierLiteral<E>
fn sample<R>(&self, rng: &mut R) -> IdentifierLiteral<E>
T, using rng as the source of randomness.Source§fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
fn sample_iter<R>(self, rng: R) -> DistIter<Self, R, T>
T, using rng as
the source of randomness. Read moreSource§impl<E> Equal for IdentifierLiteral<E>where
E: Environment,
impl<E> Equal for IdentifierLiteral<E>where
E: Environment,
Source§fn is_equal(
&self,
other: &IdentifierLiteral<E>,
) -> <IdentifierLiteral<E> as Equal>::Output
fn is_equal( &self, other: &IdentifierLiteral<E>, ) -> <IdentifierLiteral<E> as Equal>::Output
Returns true if self and other are equal.
Source§fn is_not_equal(
&self,
other: &IdentifierLiteral<E>,
) -> <IdentifierLiteral<E> as Equal>::Output
fn is_not_equal( &self, other: &IdentifierLiteral<E>, ) -> <IdentifierLiteral<E> as Equal>::Output
Returns true if self and other are not equal.
type Output = Boolean<E>
Source§impl<E> FromBits for IdentifierLiteral<E>where
E: Environment,
impl<E> FromBits for IdentifierLiteral<E>where
E: Environment,
Source§fn from_bits_le(bits_le: &[bool]) -> Result<IdentifierLiteral<E>, Error>
fn from_bits_le(bits_le: &[bool]) -> Result<IdentifierLiteral<E>, Error>
Initializes an identifier literal from a list of little-endian bits.
Source§fn from_bits_be(bits_be: &[bool]) -> Result<IdentifierLiteral<E>, Error>
fn from_bits_be(bits_be: &[bool]) -> Result<IdentifierLiteral<E>, Error>
Initializes an identifier literal from a list of big-endian bits.
Source§impl<E> FromBytes for IdentifierLiteral<E>where
E: Environment,
impl<E> FromBytes for IdentifierLiteral<E>where
E: Environment,
Source§fn read_le<R>(reader: R) -> Result<IdentifierLiteral<E>, Error>where
R: Read,
fn read_le<R>(reader: R) -> Result<IdentifierLiteral<E>, Error>where
R: Read,
Reads the identifier literal from a buffer.
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<E> FromField for IdentifierLiteral<E>where
E: Environment,
impl<E> FromField for IdentifierLiteral<E>where
E: Environment,
Source§fn from_field(
field: &<IdentifierLiteral<E> as FromField>::Field,
) -> Result<IdentifierLiteral<E>, Error>
fn from_field( field: &<IdentifierLiteral<E> as FromField>::Field, ) -> Result<IdentifierLiteral<E>, Error>
Creates an identifier literal from a field element.
type Field = Field<E>
Source§impl<E> FromStr for IdentifierLiteral<E>where
E: Environment,
impl<E> FromStr for IdentifierLiteral<E>where
E: Environment,
Source§impl<E> Hash for IdentifierLiteral<E>where
E: Hash + Environment,
impl<E> Hash for IdentifierLiteral<E>where
E: Hash + Environment,
Source§impl<E> Parser for IdentifierLiteral<E>where
E: Environment,
impl<E> Parser for IdentifierLiteral<E>where
E: Environment,
Source§fn parse(
string: &str,
) -> Result<(&str, IdentifierLiteral<E>), Err<VerboseError<&str>>>
fn parse( string: &str, ) -> Result<(&str, IdentifierLiteral<E>), Err<VerboseError<&str>>>
Parses a string into an identifier literal.
Syntax: '<identifier>' where identifier matches [a-zA-Z][a-zA-Z0-9_]*.
Source§impl<E> PartialEq for IdentifierLiteral<E>where
E: PartialEq + Environment,
impl<E> PartialEq for IdentifierLiteral<E>where
E: PartialEq + Environment,
Source§impl<E> Serialize for IdentifierLiteral<E>where
E: Environment,
impl<E> Serialize for IdentifierLiteral<E>where
E: Environment,
Source§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 identifier literal into a string or bytes.
Source§impl<E> SizeInBits for IdentifierLiteral<E>where
E: Environment,
impl<E> SizeInBits for IdentifierLiteral<E>where
E: Environment,
Source§fn size_in_bits() -> usize
fn size_in_bits() -> usize
Returns the size in bits of the identifier literal.
Source§impl<E> SizeInBytes for IdentifierLiteral<E>where
E: Environment,
impl<E> SizeInBytes for IdentifierLiteral<E>where
E: Environment,
Source§fn size_in_bytes() -> usize
fn size_in_bytes() -> usize
Returns the size in bytes of the identifier literal.
Source§impl<E> ToBits for IdentifierLiteral<E>where
E: Environment,
impl<E> ToBits for IdentifierLiteral<E>where
E: Environment,
Source§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 identifier literal.
Source§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 identifier literal.
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<E> ToBytes for IdentifierLiteral<E>where
E: Environment,
impl<E> ToBytes for IdentifierLiteral<E>where
E: Environment,
Source§impl<E> ToField for IdentifierLiteral<E>where
E: Environment,
impl<E> ToField for IdentifierLiteral<E>where
E: Environment,
Source§impl<E> ToFields for IdentifierLiteral<E>where
E: Environment,
impl<E> ToFields for IdentifierLiteral<E>where
E: Environment,
Source§impl<E> TypeName for IdentifierLiteral<E>where
E: Environment,
impl<E> TypeName for IdentifierLiteral<E>where
E: Environment,
impl<E> Copy for IdentifierLiteral<E>where
E: Copy + Environment,
impl<E> Eq for IdentifierLiteral<E>where
E: Eq + Environment,
impl<E> StructuralPartialEq for IdentifierLiteral<E>where
E: Environment,
Auto Trait Implementations§
impl<E> Freeze for IdentifierLiteral<E>
impl<E> RefUnwindSafe for IdentifierLiteral<E>where
E: RefUnwindSafe,
impl<E> Send for IdentifierLiteral<E>
impl<E> Sync for IdentifierLiteral<E>
impl<E> Unpin for IdentifierLiteral<E>where
E: Unpin,
impl<E> UnsafeUnpin for IdentifierLiteral<E>
impl<E> UnwindSafe for IdentifierLiteral<E>where
E: 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