Struct cml_chain_wasm::assets::utils::MultiAsset
source · pub struct MultiAsset(/* private fields */);Implementations§
source§impl MultiAsset
impl MultiAsset
pub fn new() -> Self
pub fn policy_count(&self) -> usize
pub fn insert_assets( &mut self, policy_id: &PolicyId, assets: &MapAssetNameToCoin ) -> Option<MapAssetNameToCoin>
pub fn get_assets(&self, key: &PolicyId) -> Option<MapAssetNameToCoin>
sourcepub fn get(&self, policy_id: &PolicyId, asset: &AssetName) -> Option<Coin>
pub fn get(&self, policy_id: &PolicyId, asset: &AssetName) -> Option<Coin>
Get the value of policy_id:asset_name if it exists.
sourcepub fn set(
&mut self,
policy_id: &PolicyId,
asset: &AssetName,
value: Coin
) -> Option<Coin>
pub fn set( &mut self, policy_id: &PolicyId, asset: &AssetName, value: Coin ) -> Option<Coin>
Set the value of policy_id:asset_name to value. Returns the previous value, or None if it didn’t exist
pub fn keys(&self) -> PolicyIdList
sourcepub fn checked_add(&self, rhs: &MultiAsset) -> Result<MultiAsset, JsError>
pub fn checked_add(&self, rhs: &MultiAsset) -> Result<MultiAsset, JsError>
Adds to multiassets together, checking value bounds. Does not modify self, and instead returns the result.
sourcepub fn checked_sub(&self, rhs: &MultiAsset) -> Result<MultiAsset, JsError>
pub fn checked_sub(&self, rhs: &MultiAsset) -> Result<MultiAsset, JsError>
Subtracts rhs from this multiasset. This does not modify self, and instead returns the result. If this would cause there to be fewer than 0 of a given asset an error will be returned. Use clamped_sub if you need to only try to remove assets when they exist and ignore them when they don’t.
sourcepub fn clamped_sub(&self, rhs: &MultiAsset) -> Self
pub fn clamped_sub(&self, rhs: &MultiAsset) -> Self
Sybtracts rhs from this multiasset. If this would cause there to be 0 or fewer of a given asset it will simply be removed entirely from the result.
Trait Implementations§
source§impl AsRef<AssetBundle<u64>> for MultiAsset
impl AsRef<AssetBundle<u64>> for MultiAsset
source§fn as_ref(&self) -> &MultiAsset
fn as_ref(&self) -> &MultiAsset
Converts this type into a shared reference of the (usually inferred) input type.
source§impl Clone for MultiAsset
impl Clone for MultiAsset
source§fn clone(&self) -> MultiAsset
fn clone(&self) -> MultiAsset
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 MultiAsset
impl Debug for MultiAsset
source§impl From<AssetBundle<u64>> for MultiAsset
impl From<AssetBundle<u64>> for MultiAsset
source§fn from(native: MultiAsset) -> Self
fn from(native: MultiAsset) -> Self
Converts to this type from the input type.
source§impl From<MultiAsset> for JsValue
impl From<MultiAsset> for JsValue
source§fn from(value: MultiAsset) -> Self
fn from(value: MultiAsset) -> Self
Converts to this type from the input type.
source§impl FromWasmAbi for MultiAsset
impl FromWasmAbi for MultiAsset
source§impl Into<AssetBundle<u64>> for MultiAsset
impl Into<AssetBundle<u64>> for MultiAsset
source§fn into(self) -> MultiAsset
fn into(self) -> MultiAsset
Converts this type into the (usually inferred) input type.
source§impl IntoWasmAbi for MultiAsset
impl IntoWasmAbi for MultiAsset
source§impl OptionFromWasmAbi for MultiAsset
impl OptionFromWasmAbi for MultiAsset
source§impl OptionIntoWasmAbi for MultiAsset
impl OptionIntoWasmAbi for MultiAsset
source§impl RefFromWasmAbi for MultiAsset
impl RefFromWasmAbi for MultiAsset
§type Anchor = Ref<'static, MultiAsset>
type Anchor = Ref<'static, MultiAsset>
The type that holds the reference to
Self for the duration of the
invocation of the function that has an &Self parameter. This is
required to ensure that the lifetimes don’t persist beyond one function
call, and so that they remain anonymous.source§impl RefMutFromWasmAbi for MultiAsset
impl RefMutFromWasmAbi for MultiAsset
Auto Trait Implementations§
impl Freeze for MultiAsset
impl RefUnwindSafe for MultiAsset
impl Send for MultiAsset
impl Sync for MultiAsset
impl Unpin for MultiAsset
impl UnwindSafe for MultiAsset
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
source§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::Abisource§fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
fn return_abi(self) -> <T as ReturnWasmAbi>::Abi
Same as
IntoWasmAbi::into_abi, except that it may throw and never
return in the case of Err.