pub struct Identifier<N: Network>(/* private fields */);
Expand description
An identifier is an immutable UTF-8 string, represented as a constant field element in the CurrentNetwork.
§Requirements
The identifier must not be an empty string. The identifier must not start with a number. The identifier must be alphanumeric, and may include underscores. The identifier must not consist solely of underscores. The identifier must fit within the data capacity of a base field element.
Implementations§
Source§impl<N: Network> Identifier<N>
impl<N: Network> Identifier<N>
Sourcepub fn size_in_bits(&self) -> u8
pub fn size_in_bits(&self) -> u8
Returns the number of bits of this identifier.
Trait Implementations§
Source§impl<N: Clone + Network> Clone for Identifier<N>
impl<N: Clone + Network> Clone for Identifier<N>
Source§fn clone(&self) -> Identifier<N>
fn clone(&self) -> Identifier<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 Identifier<N>
impl<N: Network> Debug for Identifier<N>
Source§impl<'de, N: Network> Deserialize<'de> for Identifier<N>
impl<'de, N: Network> Deserialize<'de> for Identifier<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 identifier from a string or bytes.
Source§impl<N: Network> Display for Identifier<N>
impl<N: Network> Display for Identifier<N>
Source§impl<N: Network> Equal for Identifier<N>
impl<N: Network> Equal for Identifier<N>
Source§impl<N: Network> From<&Identifier<N>> for Identifier<N>
impl<N: Network> From<&Identifier<N>> for Identifier<N>
Source§fn from(identifier: &Identifier<N>) -> Self
fn from(identifier: &Identifier<N>) -> Self
Returns a copy of the identifier.
Source§impl<N: Network> From<Identifier<N>> for Access<N>
impl<N: Network> From<Identifier<N>> for Access<N>
Source§fn from(identifier: Identifier<N>) -> Self
fn from(identifier: Identifier<N>) -> Self
Initializes a new member access from an identifier.
Source§impl<N: Network> From<Identifier<N>> for PlaintextType<N>
impl<N: Network> From<Identifier<N>> for PlaintextType<N>
Source§fn from(struct_: Identifier<N>) -> Self
fn from(struct_: Identifier<N>) -> Self
Initializes a plaintext type from a struct type.
Source§impl<N: Network> FromBits for Identifier<N>
impl<N: Network> FromBits for Identifier<N>
Source§fn from_bits_le(bits_le: &[bool]) -> Result<Self>
fn from_bits_le(bits_le: &[bool]) -> Result<Self>
Initializes a new identifier from a list of little-endian bits without trailing zeros.
Source§fn from_bits_be(bits_be: &[bool]) -> Result<Self>
fn from_bits_be(bits_be: &[bool]) -> Result<Self>
Initializes a new identifier from a list of big-endian bits without leading zeros.
Source§impl<N: Network> FromBytes for Identifier<N>
impl<N: Network> FromBytes for Identifier<N>
Source§impl<N: Network> FromField for Identifier<N>
impl<N: Network> FromField for Identifier<N>
Source§impl<N: Network> FromStr for Identifier<N>
impl<N: Network> FromStr for Identifier<N>
Source§impl<N: Network> Hash for Identifier<N>
impl<N: Network> Hash for Identifier<N>
Source§impl<N: Network> Parser for Identifier<N>
impl<N: Network> Parser for Identifier<N>
Source§impl<N: Network> PartialEq for Identifier<N>
impl<N: Network> PartialEq for Identifier<N>
Source§impl<N: Network> Serialize for Identifier<N>
impl<N: Network> Serialize for Identifier<N>
Source§impl<N: Network> ToBits for &Identifier<N>
impl<N: Network> ToBits for &Identifier<N>
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.
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.
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> ToBits for Identifier<N>
impl<N: Network> ToBits for Identifier<N>
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.
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.
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 Identifier<N>
impl<N: Network> ToBytes for Identifier<N>
Source§impl<N: Network> ToField for &Identifier<N>
impl<N: Network> ToField for &Identifier<N>
Source§impl<N: Network> ToField for Identifier<N>
impl<N: Network> ToField for Identifier<N>
impl<N: Copy + Network> Copy for Identifier<N>
impl<N: Network> Eq for Identifier<N>
Auto Trait Implementations§
impl<N> Freeze for Identifier<N>
impl<N> RefUnwindSafe for Identifier<N>
impl<N> Send for Identifier<N>
impl<N> Sync for Identifier<N>
impl<N> Unpin for Identifier<N>
impl<N> UnwindSafe for Identifier<N>
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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