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 duplicate 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 LongRefFromWasmAbi for MultiAsset
impl LongRefFromWasmAbi 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
Source§type Anchor = RcRef<MultiAsset>
type Anchor = RcRef<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
Source§impl TryFromJsValue for MultiAsset
impl TryFromJsValue for MultiAsset
Source§impl VectorFromWasmAbi for MultiAsset
impl VectorFromWasmAbi for MultiAsset
type Abi = <Box<[JsValue]> as FromWasmAbi>::Abi
unsafe fn vector_from_abi(js: Self::Abi) -> Box<[MultiAsset]>
Source§impl VectorIntoJsValue for MultiAsset
impl VectorIntoJsValue for MultiAsset
fn vector_into_jsvalue(vector: Box<[MultiAsset]>) -> JsValue
Source§impl VectorIntoWasmAbi for MultiAsset
impl VectorIntoWasmAbi for MultiAsset
type Abi = <Box<[JsValue]> as IntoWasmAbi>::Abi
fn vector_into_abi(vector: Box<[MultiAsset]>) -> Self::Abi
Source§impl WasmDescribeVector for MultiAsset
impl WasmDescribeVector for MultiAsset
impl SupportsConstructor for MultiAsset
impl SupportsInstanceProperty for MultiAsset
impl SupportsStaticProperty 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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
Converts
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>
Converts
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 moreSource§impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
impl<T> ReturnWasmAbi for Twhere
T: IntoWasmAbi,
Source§type Abi = <T as IntoWasmAbi>::Abi
type Abi = <T as IntoWasmAbi>::Abi
Same as
IntoWasmAbi::Abi
Source§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
.