[][src]Struct concordium_std::Amount

#[repr(transparent)]pub struct Amount {
    pub micro_gtu: u64,
}

The type of amounts on the chain

Fields

micro_gtu: u64

Implementations

impl Amount[src]

pub fn from_micro_gtu(micro_gtu: u64) -> Amount[src]

Create amount from a number of microGTU

pub fn from_gtu(gtu: u64) -> Amount[src]

Create amount from a number of GTU

pub fn zero() -> Amount[src]

Create zero amount

pub fn add_micro_gtu(self, micro_gtu: u64) -> Amount[src]

Add a number of micro GTU to an amount

pub fn checked_add(self, other: Amount) -> Option<Amount>[src]

Checked addition. Adds another amount and return None if overflow occurred

pub fn add_gtu(self, gtu: u64) -> Amount[src]

Add a number of GTU to an amount

pub fn subtract_micro_gtu(self, micro_gtu: u64) -> Amount[src]

Subtract a number of micro GTU to an amount

pub fn subtract_gtu(self, gtu: u64) -> Amount[src]

Subtract a number of GTU to an amount

pub fn quotient_remainder(self, denominator: u64) -> (Amount, Amount)[src]

Calculates the quotient and remainder of integer division

Trait Implementations

impl Add<Amount> for Amount[src]

type Output = Amount

The resulting type after applying the + operator.

impl AddAssign<Amount> for Amount[src]

impl Clone for Amount[src]

impl Copy for Amount[src]

impl Debug for Amount[src]

impl Deserial for Amount[src]

impl Eq for Amount[src]

impl FromStr for Amount[src]

Parse from string in GTU 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 and m must be non-negative.

type Err = AmountParseError

The associated error which can be returned from parsing.

impl Mul<u64> for Amount[src]

type Output = Amount

The resulting type after applying the * operator.

impl MulAssign<u64> for Amount[src]

impl Ord for Amount[src]

impl PartialEq<Amount> for Amount[src]

impl PartialOrd<Amount> for Amount[src]

impl Rem<u64> for Amount[src]

type Output = Amount

The resulting type after applying the % operator.

impl RemAssign<u64> for Amount[src]

impl SchemaType for Amount[src]

impl Serial for Amount[src]

impl StructuralEq for Amount[src]

impl StructuralPartialEq for Amount[src]

impl Sub<Amount> for Amount[src]

type Output = Amount

The resulting type after applying the - operator.

impl SubAssign<Amount> for Amount[src]

impl Sum<Amount> for Amount[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<A> Serialize for A where
    A: Serial + Deserial
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.