pub struct ExtraCurrencyCollection(/* private fields */);Expand description
Dictionary with amounts for multiple currencies.
Implementations§
Source§impl ExtraCurrencyCollection
impl ExtraCurrencyCollection
Sourcepub const fn from_raw(dict: Option<Cell>) -> Self
pub const fn from_raw(dict: Option<Cell>) -> Self
Creates a currency collection from a raw cell.
Sourcepub fn try_from_iter<I>(iter: I) -> Result<Self, Error>
pub fn try_from_iter<I>(iter: I) -> Result<Self, Error>
Creates an ExtraCurrencyCollection from an iterator of id-amount pairs.
Sourcepub const fn as_dict(&self) -> &Dict<u32, VarUint248>
pub const fn as_dict(&self) -> &Dict<u32, VarUint248>
Returns a reference to the underlying dictionary.
Sourcepub fn into_dict(self) -> Dict<u32, VarUint248>
pub fn into_dict(self) -> Dict<u32, VarUint248>
Returns the underlying dictionary.
Sourcepub fn as_dict_mut(&mut self) -> &mut Dict<u32, VarUint248>
pub fn as_dict_mut(&mut self) -> &mut Dict<u32, VarUint248>
Returns a mutable reference to the underlying dictionary.
Sourcepub fn normalized(&self) -> Result<Self, Error>
pub fn normalized(&self) -> Result<Self, Error>
Removes all currencies with zero balance.
Sourcepub fn checked_add(&self, other: &Self) -> Result<Self, Error>
pub fn checked_add(&self, other: &Self) -> Result<Self, Error>
Checked extra currency collection addition.
Computes self + rhs for each currency, returning Err
if overflow occurred or dictionaries had invalid structure.
Sourcepub fn checked_sub(&self, other: &Self) -> Result<Self, Error>
pub fn checked_sub(&self, other: &Self) -> Result<Self, Error>
Checked extra currency subtraction.
Computes self - rhs for each currency, returning Err
if overflow occurred or dictionaries had invalid structure.
Sourcepub fn checked_clamp(&self, other: &Self) -> Result<Self, Error>
pub fn checked_clamp(&self, other: &Self) -> Result<Self, Error>
Returns the intersection between two extra currency collections.
Trait Implementations§
Source§impl Clone for ExtraCurrencyCollection
impl Clone for ExtraCurrencyCollection
Source§fn clone(&self) -> ExtraCurrencyCollection
fn clone(&self) -> ExtraCurrencyCollection
Returns a duplicate of the value. Read more
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ExtraCurrencyCollection
impl Debug for ExtraCurrencyCollection
Source§impl Default for ExtraCurrencyCollection
impl Default for ExtraCurrencyCollection
Source§impl<'de> Deserialize<'de> for ExtraCurrencyCollection
impl<'de> Deserialize<'de> for ExtraCurrencyCollection
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl ExactSize for ExtraCurrencyCollection
impl ExactSize for ExtraCurrencyCollection
Source§fn exact_size(&self) -> Size
fn exact_size(&self) -> Size
Exact size of the value when it is stored in a slice.
Source§impl From<Dict<u32, VarUint248>> for ExtraCurrencyCollection
impl From<Dict<u32, VarUint248>> for ExtraCurrencyCollection
Source§impl From<ExtraCurrencyCollection> for Dict<u32, VarUint248>
impl From<ExtraCurrencyCollection> for Dict<u32, VarUint248>
Source§fn from(value: ExtraCurrencyCollection) -> Self
fn from(value: ExtraCurrencyCollection) -> Self
Converts to this type from the input type.
Source§impl<'tlb> Load<'tlb> for ExtraCurrencyCollection
impl<'tlb> Load<'tlb> for ExtraCurrencyCollection
Source§impl PartialEq for ExtraCurrencyCollection
impl PartialEq for ExtraCurrencyCollection
Source§fn eq(&self, other: &ExtraCurrencyCollection) -> bool
fn eq(&self, other: &ExtraCurrencyCollection) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for ExtraCurrencyCollection
impl Serialize for ExtraCurrencyCollection
Source§impl Store for ExtraCurrencyCollection
impl Store for ExtraCurrencyCollection
Source§fn store_into(
&self,
__builder: &mut CellBuilder,
__context: &dyn CellContext,
) -> Result<(), Error>
fn store_into( &self, __builder: &mut CellBuilder, __context: &dyn CellContext, ) -> Result<(), Error>
Tries to store itself into the cell builder.
Source§impl TryFrom<&BTreeMap<u32, VarUint248>> for ExtraCurrencyCollection
impl TryFrom<&BTreeMap<u32, VarUint248>> for ExtraCurrencyCollection
Source§impl<S> TryFrom<&HashMap<u32, VarUint248, S>> for ExtraCurrencyCollectionwhere
S: BuildHasher,
impl<S> TryFrom<&HashMap<u32, VarUint248, S>> for ExtraCurrencyCollectionwhere
S: BuildHasher,
Source§impl TryFrom<BTreeMap<u32, VarUint248>> for ExtraCurrencyCollection
impl TryFrom<BTreeMap<u32, VarUint248>> for ExtraCurrencyCollection
Source§impl<S> TryFrom<HashMap<u32, VarUint248, S>> for ExtraCurrencyCollectionwhere
S: BuildHasher,
impl<S> TryFrom<HashMap<u32, VarUint248, S>> for ExtraCurrencyCollectionwhere
S: BuildHasher,
impl Eq for ExtraCurrencyCollection
impl StructuralPartialEq for ExtraCurrencyCollection
Auto Trait Implementations§
impl Freeze for ExtraCurrencyCollection
impl !RefUnwindSafe for ExtraCurrencyCollection
impl Send for ExtraCurrencyCollection
impl Sync for ExtraCurrencyCollection
impl Unpin for ExtraCurrencyCollection
impl !UnwindSafe for ExtraCurrencyCollection
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<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
Compares
self to key and returns true if they are equal.