pub struct CurrencyCollection {
pub tokens: Tokens,
pub other: ExtraCurrencyCollection,
}Expand description
Amounts collection.
Fields§
§tokens: TokensAmount in native currency.
other: ExtraCurrencyCollectionAmounts in other currencies.
Implementations§
Source§impl CurrencyCollection
impl CurrencyCollection
Sourcepub const ZERO: Self
pub const ZERO: Self
The additive identity for the currency collection (with empty extra currencies).
Sourcepub const fn new(tokens: u128) -> Self
pub const fn new(tokens: u128) -> Self
Creates a new currency collection with from the specified tokens amount and empty extra currency collection.
Sourcepub fn checked_add(&self, other: &Self) -> Result<Self, Error>
pub fn checked_add(&self, other: &Self) -> Result<Self, Error>
Checked 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 currency collection subtraction.
Computes self - rhs for each currency, returning Err
if overflow occurred or dictionaries had invalid structure.
Sourcepub fn try_add_assign_tokens(&mut self, other: Tokens) -> Result<(), Error>
pub fn try_add_assign_tokens(&mut self, other: Tokens) -> Result<(), Error>
Tries to add the specified amount of native tokens to the collection.
Sourcepub fn try_sub_assign_tokens(&mut self, other: Tokens) -> Result<(), Error>
pub fn try_sub_assign_tokens(&mut self, other: Tokens) -> Result<(), Error>
Tries to subtract the specified amount of native tokens from the collection.
Sourcepub fn try_add_assign(&mut self, other: &Self) -> Result<(), Error>
pub fn try_add_assign(&mut self, other: &Self) -> Result<(), Error>
Tries to add an other currency collection to the current one.
Sourcepub fn try_sub_assign(&mut self, other: &Self) -> Result<(), Error>
pub fn try_sub_assign(&mut self, other: &Self) -> Result<(), Error>
Tries to subtract an other currency collection from the current one.
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 currency collections.
Trait Implementations§
Source§impl AugDictExtra for CurrencyCollection
impl AugDictExtra for CurrencyCollection
Source§impl Clone for CurrencyCollection
impl Clone for CurrencyCollection
Source§fn clone(&self) -> CurrencyCollection
fn clone(&self) -> CurrencyCollection
1.0.0 · Source§const fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CurrencyCollection
impl Debug for CurrencyCollection
Source§impl Default for CurrencyCollection
impl Default for CurrencyCollection
Source§impl<'de> Deserialize<'de> for CurrencyCollection
impl<'de> Deserialize<'de> for CurrencyCollection
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>,
Source§impl ExactSize for CurrencyCollection
impl ExactSize for CurrencyCollection
Source§fn exact_size(&self) -> Size
fn exact_size(&self) -> Size
Source§impl From<Tokens> for CurrencyCollection
impl From<Tokens> for CurrencyCollection
Source§impl<'tlb> Load<'tlb> for CurrencyCollection
impl<'tlb> Load<'tlb> for CurrencyCollection
Source§impl PartialEq for CurrencyCollection
impl PartialEq for CurrencyCollection
Source§impl Serialize for CurrencyCollection
impl Serialize for CurrencyCollection
Source§impl Store for CurrencyCollection
impl Store for CurrencyCollection
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>
impl Eq for CurrencyCollection
impl StructuralPartialEq for CurrencyCollection
Auto Trait Implementations§
impl Freeze for CurrencyCollection
impl !RefUnwindSafe for CurrencyCollection
impl Send for CurrencyCollection
impl Sync for CurrencyCollection
impl Unpin for CurrencyCollection
impl !UnwindSafe for CurrencyCollection
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§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
self to key and returns true if they are equal.