Enum scrypto::prelude::NonFungibleLocalId
source · pub enum NonFungibleLocalId {
String(StringNonFungibleLocalId),
Integer(IntegerNonFungibleLocalId),
Bytes(BytesNonFungibleLocalId),
RUID(RUIDNonFungibleLocalId),
}
Expand description
Represents the local id of a non-fungible.
Variants§
String(StringNonFungibleLocalId)
String matching [_0-9a-zA-Z]{1,64}
.
Create using NonFungibleLocalId::string(...).unwrap()
.
Integer(IntegerNonFungibleLocalId)
Unsigned integers, up to u64.
Create using NonFungibleLocalId::integer(...)
.
Bytes(BytesNonFungibleLocalId)
Bytes, of length between 1 and 64.
Create using NonFungibleLocalId::bytes(...).unwrap()
.
RUID(RUIDNonFungibleLocalId)
RUID, v4, variant 1, big endian. See https://www.rfc-editor.org/rfc/rfc4122
Create using NonFungibleLocalId::ruid(...).unwrap()
.
Implementations§
source§impl NonFungibleLocalId
impl NonFungibleLocalId
pub fn string<T>(value: T) -> Result<NonFungibleLocalId, ContentValidationError>
pub const fn integer(value: u64) -> NonFungibleLocalId
pub fn bytes<T>(value: T) -> Result<NonFungibleLocalId, ContentValidationError>
pub const fn ruid(value: [u8; 32]) -> NonFungibleLocalId
pub fn to_key(&self) -> Vec<u8> ⓘ
source§impl NonFungibleLocalId
impl NonFungibleLocalId
The implementation of const constructors for the non-fungible local id.
The const constructors are different from the non-const constructors for two main reasons:
- They have a more restricted interface that works with the nature of what is and is not
allowed in const contexts. As an example, [
&'static str
] for the string non-fungible local id instead of an [AsRef<[u8]>
]. - We wish to maintain backward compatibility of the existing interface and make very little changes there.
pub const fn const_string( value: &'static str ) -> Result<NonFungibleLocalId, ContentValidationError>
pub const fn const_integer(value: u64) -> NonFungibleLocalId
pub const fn const_bytes( value: &'static [u8] ) -> Result<NonFungibleLocalId, ContentValidationError>
pub const fn const_ruid(value: [u8; 32]) -> NonFungibleLocalId
source§impl NonFungibleLocalId
impl NonFungibleLocalId
pub fn id_type(&self) -> NonFungibleIdType
pub fn encode_body_common<X, E>(
&self,
encoder: &mut E
) -> Result<(), EncodeError>where
X: CustomValueKind,
E: Encoder<X>,
pub fn to_vec(&self) -> Vec<u8> ⓘ
pub fn decode_body_common<X, D>(
decoder: &mut D
) -> Result<NonFungibleLocalId, DecodeError>where
X: CustomValueKind,
D: Decoder<X>,
Trait Implementations§
source§impl Clone for NonFungibleLocalId
impl Clone for NonFungibleLocalId
source§fn clone(&self) -> NonFungibleLocalId
fn clone(&self) -> NonFungibleLocalId
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for NonFungibleLocalId
impl Debug for NonFungibleLocalId
source§impl<D> Decode<ManifestCustomValueKind, D> for NonFungibleLocalIdwhere
D: Decoder<ManifestCustomValueKind>,
impl<D> Decode<ManifestCustomValueKind, D> for NonFungibleLocalIdwhere
D: Decoder<ManifestCustomValueKind>,
source§fn decode_body_with_value_kind(
decoder: &mut D,
value_kind: ValueKind<ManifestCustomValueKind>
) -> Result<NonFungibleLocalId, DecodeError>
fn decode_body_with_value_kind( decoder: &mut D, value_kind: ValueKind<ManifestCustomValueKind> ) -> Result<NonFungibleLocalId, DecodeError>
Decodes the type from the decoder, which should match a preloaded value kind. Read more
source§impl<D> Decode<ScryptoCustomValueKind, D> for NonFungibleLocalIdwhere
D: Decoder<ScryptoCustomValueKind>,
impl<D> Decode<ScryptoCustomValueKind, D> for NonFungibleLocalIdwhere
D: Decoder<ScryptoCustomValueKind>,
source§fn decode_body_with_value_kind(
decoder: &mut D,
value_kind: ValueKind<ScryptoCustomValueKind>
) -> Result<NonFungibleLocalId, DecodeError>
fn decode_body_with_value_kind( decoder: &mut D, value_kind: ValueKind<ScryptoCustomValueKind> ) -> Result<NonFungibleLocalId, DecodeError>
Decodes the type from the decoder, which should match a preloaded value kind. Read more
source§impl Describe<ScryptoCustomTypeKind> for NonFungibleLocalId
impl Describe<ScryptoCustomTypeKind> for NonFungibleLocalId
source§const TYPE_ID: RustTypeId = _
const TYPE_ID: RustTypeId = _
The
TYPE_ID
should give a unique identifier for its SBOR schema type.
An SBOR schema type capture details about the SBOR payload, how it should be interpreted, validated and displayed. Read moresource§fn type_data() -> TypeData<ScryptoCustomTypeKind, RustTypeId>
fn type_data() -> TypeData<ScryptoCustomTypeKind, RustTypeId>
Returns the local schema for the given type. Read more
source§fn add_all_dependencies(aggregator: &mut TypeAggregator<C>)
fn add_all_dependencies(aggregator: &mut TypeAggregator<C>)
For each type referenced in
get_local_type_data
, we need to ensure that the type and all of its own references
get added to the aggregator. Read moresource§impl Display for NonFungibleLocalId
impl Display for NonFungibleLocalId
source§impl<E> Encode<ManifestCustomValueKind, E> for NonFungibleLocalIdwhere
E: Encoder<ManifestCustomValueKind>,
impl<E> Encode<ManifestCustomValueKind, E> for NonFungibleLocalIdwhere
E: Encoder<ManifestCustomValueKind>,
source§fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>
fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>
Encodes the SBOR value’s kind to the encoder
source§fn encode_body(&self, encoder: &mut E) -> Result<(), EncodeError>
fn encode_body(&self, encoder: &mut E) -> Result<(), EncodeError>
Encodes the SBOR body of the type to the encoder. Read more
source§impl<E> Encode<ScryptoCustomValueKind, E> for NonFungibleLocalIdwhere
E: Encoder<ScryptoCustomValueKind>,
impl<E> Encode<ScryptoCustomValueKind, E> for NonFungibleLocalIdwhere
E: Encoder<ScryptoCustomValueKind>,
source§fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>
fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>
Encodes the SBOR value’s kind to the encoder
source§fn encode_body(&self, encoder: &mut E) -> Result<(), EncodeError>
fn encode_body(&self, encoder: &mut E) -> Result<(), EncodeError>
Encodes the SBOR body of the type to the encoder. Read more
source§impl From<BytesNonFungibleLocalId> for NonFungibleLocalId
impl From<BytesNonFungibleLocalId> for NonFungibleLocalId
source§fn from(value: BytesNonFungibleLocalId) -> NonFungibleLocalId
fn from(value: BytesNonFungibleLocalId) -> NonFungibleLocalId
Converts to this type from the input type.
source§impl From<IntegerNonFungibleLocalId> for NonFungibleLocalId
impl From<IntegerNonFungibleLocalId> for NonFungibleLocalId
source§fn from(value: IntegerNonFungibleLocalId) -> NonFungibleLocalId
fn from(value: IntegerNonFungibleLocalId) -> NonFungibleLocalId
Converts to this type from the input type.
source§impl From<RUIDNonFungibleLocalId> for NonFungibleLocalId
impl From<RUIDNonFungibleLocalId> for NonFungibleLocalId
source§fn from(value: RUIDNonFungibleLocalId) -> NonFungibleLocalId
fn from(value: RUIDNonFungibleLocalId) -> NonFungibleLocalId
Converts to this type from the input type.
source§impl From<StringNonFungibleLocalId> for NonFungibleLocalId
impl From<StringNonFungibleLocalId> for NonFungibleLocalId
source§fn from(value: StringNonFungibleLocalId) -> NonFungibleLocalId
fn from(value: StringNonFungibleLocalId) -> NonFungibleLocalId
Converts to this type from the input type.
source§impl From<u64> for NonFungibleLocalId
impl From<u64> for NonFungibleLocalId
source§fn from(value: u64) -> NonFungibleLocalId
fn from(value: u64) -> NonFungibleLocalId
Converts to this type from the input type.
source§impl FromStr for NonFungibleLocalId
impl FromStr for NonFungibleLocalId
§type Err = ParseNonFungibleLocalIdError
type Err = ParseNonFungibleLocalIdError
The associated error which can be returned from parsing.
source§fn from_str(
s: &str
) -> Result<NonFungibleLocalId, <NonFungibleLocalId as FromStr>::Err>
fn from_str( s: &str ) -> Result<NonFungibleLocalId, <NonFungibleLocalId as FromStr>::Err>
Parses a string
s
to return a value of this type. Read moresource§impl Hash for NonFungibleLocalId
impl Hash for NonFungibleLocalId
source§impl MetadataVal for NonFungibleLocalId
impl MetadataVal for NonFungibleLocalId
const DISCRIMINATOR: u8 = 11u8
fn to_metadata_value( self ) -> GenericMetadataValue<UncheckedUrl, UncheckedOrigin>
fn from_metadata_value( entry: GenericMetadataValue<UncheckedUrl, UncheckedOrigin> ) -> Result<NonFungibleLocalId, MetadataConversionError>
source§impl Ord for NonFungibleLocalId
impl Ord for NonFungibleLocalId
source§fn cmp(&self, other: &NonFungibleLocalId) -> Ordering
fn cmp(&self, other: &NonFungibleLocalId) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for NonFungibleLocalId
impl PartialEq for NonFungibleLocalId
source§fn eq(&self, other: &NonFungibleLocalId) -> bool
fn eq(&self, other: &NonFungibleLocalId) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd for NonFungibleLocalId
impl PartialOrd for NonFungibleLocalId
source§fn partial_cmp(&self, other: &NonFungibleLocalId) -> Option<Ordering>
fn partial_cmp(&self, other: &NonFungibleLocalId) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl ToMetadataEntry for NonFungibleLocalId
impl ToMetadataEntry for NonFungibleLocalId
fn to_metadata_entry( self ) -> Option<GenericMetadataValue<UncheckedUrl, UncheckedOrigin>>
source§impl TryFrom<String> for NonFungibleLocalId
impl TryFrom<String> for NonFungibleLocalId
§type Error = ContentValidationError
type Error = ContentValidationError
The type returned in the event of a conversion error.
source§fn try_from(
value: String
) -> Result<NonFungibleLocalId, <NonFungibleLocalId as TryFrom<String>>::Error>
fn try_from( value: String ) -> Result<NonFungibleLocalId, <NonFungibleLocalId as TryFrom<String>>::Error>
Performs the conversion.
source§impl TryFrom<Vec<u8>> for NonFungibleLocalId
impl TryFrom<Vec<u8>> for NonFungibleLocalId
§type Error = ContentValidationError
type Error = ContentValidationError
The type returned in the event of a conversion error.
impl Eq for NonFungibleLocalId
impl StructuralPartialEq for NonFungibleLocalId
Auto Trait Implementations§
impl RefUnwindSafe for NonFungibleLocalId
impl Send for NonFungibleLocalId
impl Sync for NonFungibleLocalId
impl Unpin for NonFungibleLocalId
impl UnwindSafe for NonFungibleLocalId
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
Casts
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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
Mutably borrows from an owned value. Read more
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
Compare self to
key
and return true
if they are equal.§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
Checks if this value is equivalent to the given key. Read more