Struct concordium_contracts_common::Amount
source · [−]#[repr(transparent)]pub struct Amount {
pub micro_ccd: u64,
}
Expand description
The type of amounts on the chain
Fields
micro_ccd: u64
Implementations
sourceimpl 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 return None if overflow 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
sourceimpl AddAssign<Amount> for Amount
impl AddAssign<Amount> for Amount
sourcefn add_assign(&mut self, other: Amount)
fn add_assign(&mut self, other: Amount)
Performs the +=
operation. Read more
sourceimpl 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.
sourceimpl MulAssign<u64> for Amount
impl MulAssign<u64> for Amount
sourcefn mul_assign(&mut self, other: u64)
fn mul_assign(&mut self, other: u64)
Performs the *=
operation. Read more
sourceimpl Ord for Amount
impl Ord for Amount
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Self where
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialEq<Amount> for Amount
impl PartialEq<Amount> for Amount
sourceimpl PartialOrd<Amount> for Amount
impl PartialOrd<Amount> for Amount
sourcefn partial_cmp(&self, other: &Amount) -> Option<Ordering>
fn partial_cmp(&self, other: &Amount) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn 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 more
sourceimpl RemAssign<u64> for Amount
impl RemAssign<u64> for Amount
sourcefn rem_assign(&mut self, other: u64)
fn rem_assign(&mut self, other: u64)
Performs the %=
operation. Read more
sourceimpl SubAssign<Amount> for Amount
impl SubAssign<Amount> for Amount
sourcefn sub_assign(&mut self, other: Amount)
fn sub_assign(&mut self, other: Amount)
Performs the -=
operation. Read more
impl Copy for Amount
impl Eq for Amount
impl StructuralEq for Amount
impl StructuralPartialEq for Amount
Auto Trait Implementations
impl RefUnwindSafe for Amount
impl Send for Amount
impl Sync for Amount
impl Unpin for Amount
impl UnwindSafe for Amount
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more