Struct concordium_std::Amount
source · pub struct Amount {
pub micro_ccd: u64,
}
Expand description
The type of amounts on the chain
Fields§
§micro_ccd: u64
Implementations§
source§impl Amount
impl Amount
sourcepub const fn from_micro_ccd(micro_ccd: u64) -> Amount
pub const fn from_micro_ccd(micro_ccd: u64) -> Amount
Create amount from a number of microCCD
sourcepub fn add_micro_ccd(self, micro_ccd: u64) -> Amount
pub fn add_micro_ccd(self, micro_ccd: u64) -> Amount
Add a number of micro CCD to an amount
sourcepub fn checked_add(self, other: Amount) -> Option<Amount>
pub fn checked_add(self, other: Amount) -> Option<Amount>
Checked addition. Adds another amount and returns None if overflow occurred.
sourcepub fn checked_sub(self, other: Amount) -> Option<Amount>
pub fn checked_sub(self, other: Amount) -> Option<Amount>
Checked subtraction. Subtracts another amount and returns None if underflow occurred.
sourcepub fn subtract_micro_ccd(self, micro_ccd: u64) -> Amount
pub fn subtract_micro_ccd(self, micro_ccd: u64) -> Amount
Subtract a number of micro CCD to an amount
sourcepub fn subtract_ccd(self, ccd: u64) -> Amount
pub fn subtract_ccd(self, ccd: u64) -> Amount
Subtract a number of CCD to an amount
sourcepub fn quotient_remainder(self, denominator: u64) -> (Amount, Amount)
pub fn quotient_remainder(self, denominator: u64) -> (Amount, Amount)
Calculates the quotient and remainder of integer division
Trait Implementations§
source§impl AddAssign<Amount> for Amount
impl AddAssign<Amount> for Amount
source§fn add_assign(&mut self, other: Amount)
fn add_assign(&mut self, other: Amount)
Performs the
+=
operation. Read moresource§impl FromStr for Amount
impl FromStr for Amount
Parse from string in CCD units. The input string must be of the form
n[.m]
where n
and m
are both digits. The notation [.m]
indicates
that that part is optional.
- if
n
starts with 0 then it must be 0l m
can have at most 6 digits, and must have at least 1- both
n
andm
must be non-negative.
source§impl MulAssign<u64> for Amount
impl MulAssign<u64> for Amount
source§fn mul_assign(&mut self, other: u64)
fn mul_assign(&mut self, other: u64)
Performs the
*=
operation. Read moresource§impl Ord for Amount
impl Ord for Amount
source§impl PartialEq<Amount> for Amount
impl PartialEq<Amount> for Amount
source§impl PartialOrd<Amount> for Amount
impl PartialOrd<Amount> for Amount
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl RemAssign<u64> for Amount
impl RemAssign<u64> for Amount
source§fn rem_assign(&mut self, other: u64)
fn rem_assign(&mut self, other: u64)
Performs the
%=
operation. Read moresource§impl SubAssign<Amount> for Amount
impl SubAssign<Amount> for Amount
source§fn sub_assign(&mut self, other: Amount)
fn sub_assign(&mut self, other: Amount)
Performs the
-=
operation. Read more