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]
impl AmountTrait Implementations
impl Debug for Amount[src]
impl Debug for Amountfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Eq for Amount[src]
impl Eq for Amountimpl PartialEq for Amount[src]
impl PartialEq for Amountfn eq(&self, other: &Amount) -> bool[src]
fn eq(&self, other: &Amount) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Amount) -> bool[src]
fn ne(&self, other: &Amount) -> boolThis method tests for !=.
impl Ord for Amount[src]
impl Ord for Amountfn cmp(&self, other: &Amount) -> Ordering[src]
fn cmp(&self, other: &Amount) -> OrderingThis method returns an Ordering between self and other. Read more
fn max(self, other: Self) -> Self1.21.0[src]
fn max(self, other: Self) -> SelfCompares and returns the maximum of two values. Read more
fn min(self, other: Self) -> Self1.21.0[src]
fn min(self, other: Self) -> SelfCompares and returns the minimum of two values. Read more
impl PartialOrd for Amount[src]
impl PartialOrd for Amountfn partial_cmp(&self, other: &Amount) -> Option<Ordering>[src]
fn partial_cmp(&self, other: &Amount) -> Option<Ordering>This method returns an ordering between self and other values if one exists. Read more
fn lt(&self, other: &Amount) -> bool[src]
fn lt(&self, other: &Amount) -> boolThis method tests less than (for self and other) and is used by the < operator. Read more
fn le(&self, other: &Amount) -> bool[src]
fn le(&self, other: &Amount) -> boolThis method tests less than or equal to (for self and other) and is used by the <= operator. Read more
fn gt(&self, other: &Amount) -> bool[src]
fn gt(&self, other: &Amount) -> boolThis method tests greater than (for self and other) and is used by the > operator. Read more
fn ge(&self, other: &Amount) -> bool[src]
fn ge(&self, other: &Amount) -> boolThis 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 Copy for Amountimpl Clone for Amount[src]
impl Clone for Amountfn clone(&self) -> Amount[src]
fn clone(&self) -> AmountReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl<'a> Add for &'a Amount[src]
impl<'a> Add for &'a Amounttype Output = Amount
The resulting type after applying the + operator.
fn add(self, other: &Amount) -> Amount[src]
fn add(self, other: &Amount) -> AmountAdding two amounts returns a new amount with the value being the sum of the two input values
impl<'a> Sub for &'a Amount[src]
impl<'a> Sub for &'a Amounttype Output = Amount
The resulting type after applying the - operator.
fn sub(self, other: &Amount) -> Amount[src]
fn sub(self, other: &Amount) -> AmountSubtracting two amounts returns a new amount with the value being the difference of the two values.
impl Display for Amount[src]
impl Display for AmountWe 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
fn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Serialize for Amount[src]
impl Serialize for AmountConverts internally stored stroop value of asset amount into full unit amount and returns a serialized string of the result.
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer, [src]
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where
S: Serializer, Serialize this value into the given Serde serializer. Read more
impl<'de> Deserialize<'de> for Amount[src]
impl<'de> Deserialize<'de> for AmountThe 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).
fn deserialize<D>(d: D) -> Result<Amount, D::Error> where
D: Deserializer<'de>, [src]
fn deserialize<D>(d: D) -> Result<Amount, D::Error> where
D: Deserializer<'de>, Deserialize this value from the given Serde deserializer. Read more
impl FromStr for Amount[src]
impl FromStr for Amount