Struct concordium_std::Amount[][src]

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

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.

pub fn add(self, other: Amount) -> <Amount as Add<Amount>>::Output[src]

Performs the + operation. Read more

impl AddAssign<Amount> for Amount[src]

pub fn add_assign(&mut self, other: Amount)[src]

Performs the += operation. Read more

impl Clone for Amount[src]

pub fn clone(&self) -> Amount[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Amount[src]

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl Deserial for Amount[src]

pub fn deserial<R>(source: &mut R) -> Result<Amount, ParseError> where
    R: Read
[src]

Attempt to read a structure from a given source, failing if an error occurs during deserialization or reading. Read more

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.

pub fn from_str(v: &str) -> Result<Amount, <Amount as FromStr>::Err>[src]

Parses a string s to return a value of this type. Read more

impl Mul<u64> for Amount[src]

type Output = Amount

The resulting type after applying the * operator.

pub fn mul(self, other: u64) -> <Amount as Mul<u64>>::Output[src]

Performs the * operation. Read more

impl MulAssign<u64> for Amount[src]

pub fn mul_assign(&mut self, other: u64)[src]

Performs the *= operation. Read more

impl Ord for Amount[src]

pub fn cmp(&self, other: &Amount) -> Ordering[src]

This method returns an Ordering between self and other. Read more

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl PartialEq<Amount> for Amount[src]

pub fn eq(&self, other: &Amount) -> bool[src]

This method tests for self and other values to be equal, and is used by ==. Read more

pub fn ne(&self, other: &Amount) -> bool[src]

This method tests for !=.

impl PartialOrd<Amount> for Amount[src]

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

This method returns an ordering between self and other values if one exists. Read more

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than (for self and other) and is used by the < operator. Read more

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

#[must_use]
fn ge(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl Rem<u64> for Amount[src]

type Output = Amount

The resulting type after applying the % operator.

pub fn rem(self, other: u64) -> <Amount as Rem<u64>>::Output[src]

Performs the % operation. Read more

impl RemAssign<u64> for Amount[src]

pub fn rem_assign(&mut self, other: u64)[src]

Performs the %= operation. Read more

impl SchemaType for Amount[src]

pub fn get_type() -> Type[src]

impl Serial for Amount[src]

pub fn serial<W>(&self, out: &mut W) -> Result<(), <W as Write>::Err> where
    W: Write
[src]

Attempt to write the structure into the provided writer, failing if only part of the structure could be written. Read more

impl Sub<Amount> for Amount[src]

type Output = Amount

The resulting type after applying the - operator.

pub fn sub(self, other: Amount) -> <Amount as Sub<Amount>>::Output[src]

Performs the - operation. Read more

impl SubAssign<Amount> for Amount[src]

pub fn sub_assign(&mut self, other: Amount)[src]

Performs the -= operation. Read more

impl Sum<Amount> for Amount[src]

pub fn sum<I>(iter: I) -> Amount where
    I: Iterator<Item = Amount>, 
[src]

Method which takes an iterator and generates Self from the elements by “summing up” the items. Read more

impl Copy for Amount[src]

impl Eq for Amount[src]

impl StructuralEq for Amount[src]

impl StructuralPartialEq for Amount[src]

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

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

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