Struct stellar_client::resources::Amount[][src]

pub struct Amount(_);

Amounts are used in several resources in the stellar ecosystem. There are a lot of conversions that must take place to display amounts to users in a way that makes sense to both users and the horizon API. That logic is contained in this module.

https://www.stellar.org/developers/guides/concepts/assets.html#amount-precision-and-representation

Methods

impl Amount
[src]

Create an amount newtype

Trait Implementations

impl Debug for Amount
[src]

Formats the value using the given formatter. Read more

impl Eq for Amount
[src]

impl PartialEq for Amount
[src]

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

This method tests for !=.

impl Ord for Amount
[src]

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

Compares and returns the maximum of two values. Read more

Compares and returns the minimum of two values. Read more

impl PartialOrd for Amount
[src]

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

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

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

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

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

impl Copy for Amount
[src]

impl Clone for Amount
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a> Add for &'a Amount
[src]

The resulting type after applying the + operator.

Adding two amounts returns a new amount with the value being the sum of the two input values

impl<'a> Sub for &'a Amount
[src]

The resulting type after applying the - operator.

Subtracting two amounts returns a new amount with the value being the difference of the two values.

impl Display for Amount
[src]

We convert amounts to their stroop values (multiply by 10^7) on serialization. When displaying values for end users, they are likely more interested in the unit values, so we divide by 10^7

Formats the value using the given formatter. Read more

impl Serialize for Amount
[src]

Converts internally stored stroop value of asset amount into full unit amount and returns a serialized string of the result.

Serialize this value into the given Serde serializer. Read more

impl<'de> Deserialize<'de> for Amount
[src]

The stellar ammount fields are represented as strings in the horizon api, however, they look like floats. But, in the actual ledger they are signed 64-bit integers. This function converts what we get from horizon into a signed integer. The precision of the float is assumed to be out to 7 digits (but if fewer are found it's ok).

Deserialize this value from the given Serde deserializer. Read more

impl FromStr for Amount
[src]

The associated error which can be returned from parsing.

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

Auto Trait Implementations

impl Send for Amount

impl Sync for Amount