pub struct Identifier<N>(/* private fields */)
where
N: Network;
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> Identifier<N>where
N: Network,
impl<N> Identifier<N>where
N: Network,
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 for Identifier<N>
impl<N> 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> Debug for Identifier<N>where
N: Network,
impl<N> Debug for Identifier<N>where
N: Network,
Source§impl<'de, N> Deserialize<'de> for Identifier<N>where
N: Network,
impl<'de, N> Deserialize<'de> for Identifier<N>where
N: Network,
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Identifier<N>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Identifier<N>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserializes the identifier from a string or bytes.
Source§impl<N> Display for Identifier<N>where
N: Network,
impl<N> Display for Identifier<N>where
N: Network,
Source§impl<N> Equal for Identifier<N>where
N: Network,
impl<N> Equal for Identifier<N>where
N: Network,
Source§fn is_equal(&self, other: &Identifier<N>) -> <Identifier<N> as Equal>::Output
fn is_equal(&self, other: &Identifier<N>) -> <Identifier<N> as Equal>::Output
Returns true
if self
and other
are equal.
Source§fn is_not_equal(
&self,
other: &Identifier<N>,
) -> <Identifier<N> as Equal>::Output
fn is_not_equal( &self, other: &Identifier<N>, ) -> <Identifier<N> as Equal>::Output
Returns true
if self
and other
are not equal.
type Output = Boolean<N>
Source§impl<N> From<&Identifier<N>> for Identifier<N>where
N: Network,
impl<N> From<&Identifier<N>> for Identifier<N>where
N: Network,
Source§fn from(identifier: &Identifier<N>) -> Identifier<N>
fn from(identifier: &Identifier<N>) -> Identifier<N>
Returns a copy of the identifier.
Source§impl<N> From<Identifier<N>> for PlaintextType<N>where
N: Network,
impl<N> From<Identifier<N>> for PlaintextType<N>where
N: Network,
Source§fn from(struct_: Identifier<N>) -> PlaintextType<N>
fn from(struct_: Identifier<N>) -> PlaintextType<N>
Initializes a plaintext type from a struct type.
Source§impl<N> FromBits for Identifier<N>where
N: Network,
impl<N> FromBits for Identifier<N>where
N: Network,
Source§fn from_bits_le(bits_le: &[bool]) -> Result<Identifier<N>, Error>
fn from_bits_le(bits_le: &[bool]) -> Result<Identifier<N>, Error>
Initializes a new identifier from a list of little-endian bits without trailing zeros.
Source§fn from_bits_be(bits_be: &[bool]) -> Result<Identifier<N>, Error>
fn from_bits_be(bits_be: &[bool]) -> Result<Identifier<N>, Error>
Initializes a new identifier from a list of big-endian bits without leading zeros.
Source§impl<N> FromBytes for Identifier<N>where
N: Network,
impl<N> FromBytes for Identifier<N>where
N: Network,
Source§impl<N> FromField for Identifier<N>where
N: Network,
impl<N> FromField for Identifier<N>where
N: Network,
Source§fn from_field(
field: &<Identifier<N> as FromField>::Field,
) -> Result<Identifier<N>, Error>
fn from_field( field: &<Identifier<N> as FromField>::Field, ) -> Result<Identifier<N>, Error>
Initializes a new identifier from a field element.
type Field = Field<N>
Source§impl<N> FromStr for Identifier<N>where
N: Network,
impl<N> FromStr for Identifier<N>where
N: Network,
Source§impl<N> Hash for Identifier<N>where
N: Network,
impl<N> Hash for Identifier<N>where
N: Network,
Source§impl<N> Parser for Identifier<N>where
N: Network,
impl<N> Parser for Identifier<N>where
N: Network,
Source§impl<N> PartialEq for Identifier<N>where
N: Network,
impl<N> PartialEq for Identifier<N>where
N: Network,
Source§impl<N> Serialize for Identifier<N>where
N: Network,
impl<N> Serialize for Identifier<N>where
N: Network,
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 into string or bytes.
Source§impl<N> ToBits for &Identifier<N>where
N: Network,
impl<N> ToBits for &Identifier<N>where
N: Network,
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> ToBits for Identifier<N>where
N: Network,
impl<N> ToBits for Identifier<N>where
N: Network,
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> ToBytes for Identifier<N>where
N: Network,
impl<N> ToBytes for Identifier<N>where
N: Network,
Source§impl<N> ToField for &Identifier<N>where
N: Network,
impl<N> ToField for &Identifier<N>where
N: Network,
Source§impl<N> ToField for Identifier<N>where
N: Network,
impl<N> ToField for Identifier<N>where
N: Network,
impl<N> Copy for Identifier<N>
impl<N> Eq for Identifier<N>where
N: Network,
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> 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