Struct miden_objects::assets::NonFungibleAsset
source · pub struct NonFungibleAsset(/* private fields */);Expand description
A commitment to a non-fungible asset.
The commitment is constructed as follows:
- Hash the asset data producing
[d0, d1, d2, d3]. - Replace the value of
d1with the fauce id producing[d0, faucet_id, d2, d3]. - Force the bit position ACCOUNT_ISFAUCET_MASK of
d3to be0.
NonFungibleAsset itself does not contain the actual asset data. The container for this data NonFungibleAssetDetails struct.
Implementations§
source§impl NonFungibleAsset
impl NonFungibleAsset
sourcepub fn new(details: &NonFungibleAssetDetails) -> Result<Self, AssetError>
pub fn new(details: &NonFungibleAssetDetails) -> Result<Self, AssetError>
Returns a non-fungible asset created from the specified asset details.
§Errors
Returns an error if the provided faucet ID is not for a non-fungible asset faucet.
sourcepub fn from_parts(
faucet_id: AccountId,
data_hash: Word,
) -> Result<Self, AssetError>
pub fn from_parts( faucet_id: AccountId, data_hash: Word, ) -> Result<Self, AssetError>
Return a non-fungible asset created from the specified faucet and using the provided hash of the asset’s data.
Hash of the asset’s data is expected to be computed from the binary representation of the asset’s data.
§Errors
Returns an error if the provided faucet ID is not for a non-fungible asset faucet.
sourcepub unsafe fn new_unchecked(value: Word) -> NonFungibleAsset
pub unsafe fn new_unchecked(value: Word) -> NonFungibleAsset
Creates a new NonFungibleAsset without checking its validity.
§Safety
This function required that the provided value is a valid word representation of a NonFungibleAsset.
pub fn vault_key(&self) -> Word
Trait Implementations§
source§impl Clone for NonFungibleAsset
impl Clone for NonFungibleAsset
source§fn clone(&self) -> NonFungibleAsset
fn clone(&self) -> NonFungibleAsset
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for NonFungibleAsset
impl Debug for NonFungibleAsset
source§impl Display for NonFungibleAsset
impl Display for NonFungibleAsset
source§impl From<NonFungibleAsset> for Word
impl From<NonFungibleAsset> for Word
source§fn from(asset: NonFungibleAsset) -> Self
fn from(asset: NonFungibleAsset) -> Self
source§impl From<NonFungibleAsset> for [u8; 32]
impl From<NonFungibleAsset> for [u8; 32]
source§fn from(asset: NonFungibleAsset) -> Self
fn from(asset: NonFungibleAsset) -> Self
source§impl From<NonFungibleAsset> for Asset
impl From<NonFungibleAsset> for Asset
source§fn from(asset: NonFungibleAsset) -> Self
fn from(asset: NonFungibleAsset) -> Self
source§impl PartialEq for NonFungibleAsset
impl PartialEq for NonFungibleAsset
source§fn eq(&self, other: &NonFungibleAsset) -> bool
fn eq(&self, other: &NonFungibleAsset) -> bool
self and other values to be equal, and is used
by ==.source§impl TryFrom<[BaseElement; 4]> for NonFungibleAsset
impl TryFrom<[BaseElement; 4]> for NonFungibleAsset
impl Copy for NonFungibleAsset
impl Eq for NonFungibleAsset
impl StructuralPartialEq for NonFungibleAsset
Auto Trait Implementations§
impl Freeze for NonFungibleAsset
impl RefUnwindSafe for NonFungibleAsset
impl Send for NonFungibleAsset
impl Sync for NonFungibleAsset
impl Unpin for NonFungibleAsset
impl UnwindSafe for NonFungibleAsset
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§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)