Struct concordium_base::common::types::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§
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 Deserial for Amount
impl Deserial for Amount
fn deserial<R: ReadBytesExt>(source: &mut R) -> ParseResult<Self>
source§impl<'de> Deserialize<'de> for Amount
impl<'de> Deserialize<'de> for Amount
source§fn deserialize<D>(des: D) -> Result<Amount, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(des: D) -> Result<Amount, <D as Deserializer<'de>>::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§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 Serialize for Amount
impl Serialize for Amount
source§fn serialize<S>(
&self,
ser: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>( &self, ser: S ) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where S: Serializer,
Serialize this value into the given Serde serializer. Read more
source§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 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§
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