pub struct AssetId(/* private fields */);Expand description
A CAT asset id — the TAIL hash that names one token on the Chia chain.
Stored as the 32 raw bytes rather than a String so two spellings of the same id (uppercase,
0x-prefixed) cannot compare unequal. Parsing normalizes; emission is always lowercase and
unprefixed.
Implementations§
Source§impl AssetId
impl AssetId
Sourcepub const fn new(bytes: [u8; 32]) -> Self
pub const fn new(bytes: [u8; 32]) -> Self
Wrap 32 already-decoded bytes. const so canonical ids can be declared as constants.
Sourcepub fn from_hex(hex: &str) -> Result<Self, AssetIdParseError>
pub fn from_hex(hex: &str) -> Result<Self, AssetIdParseError>
Parse a hex asset id. A 0x prefix and uppercase digits are TOLERATED on input — both are
what a block explorer prints — and normalized away; neither is ever emitted.
Sourcepub fn to_hex(&self) -> String
pub fn to_hex(&self) -> String
The canonical wire spelling: lowercase, unprefixed, ASSET_ID_HEX_LEN characters.
Trait Implementations§
impl Copy for AssetId
impl Eq for AssetId
Source§impl Ord for AssetId
impl Ord for AssetId
1.21.0 (const: unstable) · 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
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for AssetId
impl PartialOrd for AssetId
impl StructuralPartialEq for AssetId
Auto Trait Implementations§
impl Freeze for AssetId
impl RefUnwindSafe for AssetId
impl Send for AssetId
impl Sync for AssetId
impl Unpin for AssetId
impl UnsafeUnpin for AssetId
impl UnwindSafe for AssetId
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
Mutably borrows from an owned value. Read more