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
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 moresourceimpl 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 moresourceimpl Ord for Amount
impl Ord for Amount
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
Restrict a value to a certain interval. Read more
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>
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 moresourceimpl 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 moresourceimpl 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 moreimpl 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 Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
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