Struct pure_decimal::Decimal [] [src]

pub struct Decimal(_);

Examples:




// Use as keys in BTree
let mut map = BTreeMap::new();
map.insert(dec!(1.0), dec!(1.0));
map.insert(dec!(1), dec!(2.0));

assert!(map.len() == 1);
assert!(map.contains_key(&dec!(1.00)));
assert!(map.get(&dec!(1.00)) == Some(&dec!(2.0)));

Methods

impl Decimal
[src]

[src]

Creates a Decimal with 0 as value

[src]

returns the larger of self and other

[src]

returns the smaller of self and other

[src]

returns absolute value of self

[src]

Calculates the fused multiply-add self × a + b and returns the result. The multiply is carried out first and is exact, so this operation has only the one, final, rounding.

[src]

returns true if self is less than zero

[src]

[src]

returns true if self is zero

[src]

see [decimal::d128::pow]

Trait Implementations

impl Clone for Decimal
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for Decimal
[src]

impl Default for Decimal
[src]

[src]

Returns the "default value" for a type. Read more

impl Hash for Decimal
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl FromStr for Decimal
[src]

The associated error which can be returned from parsing.

[src]

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

impl Display for Decimal
[src]

Delegates to d128.

[src]

Formats the value using the given formatter. Read more

impl Debug for Decimal
[src]

Delegates to d128.

[src]

Formats the value using the given formatter.

impl LowerExp for Decimal
[src]

Delegates to d128.

[src]

Formats the value using the given formatter.

impl LowerHex for Decimal
[src]

Delegates to d128.

[src]

Formats the value using the given formatter.

impl PartialEq<Decimal> for Decimal
[src]

[src]

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

1.0.0
[src]

This method tests for !=.

impl Eq for Decimal
[src]

impl PartialOrd<Decimal> for Decimal
[src]

[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

1.0.0
[src]

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

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 Ord for Decimal
[src]

[src]

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

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more

impl From<i32> for Decimal
[src]

[src]

Performs the conversion.

impl From<u32> for Decimal
[src]

Converts an u32 to d128. The result is exact and no error is possible.

[src]

Performs the conversion.

impl From<u64> for Decimal
[src]

Converts an u64 to d128. The result is exact and no error is possible.

[src]

Performs the conversion.

impl From<i64> for Decimal
[src]

Converts an i64 to d128. The result is exact and no error is possible.

[src]

Performs the conversion.

impl AsRef<Decimal> for Decimal
[src]

[src]

Performs the conversion.

impl Neg for Decimal
[src]

The resulting type after applying the - operator.

[src]

Performs the unary - operation.

impl<'a> Neg for &'a Decimal
[src]

The resulting type after applying the - operator.

[src]

Performs the unary - operation.

impl Add<Decimal> for Decimal
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

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

The resulting type after applying the + operator.

[src]

Performs the + operation.

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

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<'a, 'b> Add<&'a Decimal> for &'b Decimal
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl Sub<Decimal> for Decimal
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

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

The resulting type after applying the - operator.

[src]

Performs the - operation.

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

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<'a, 'b> Sub<&'a Decimal> for &'b Decimal
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl Mul<Decimal> for Decimal
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a> Mul<Decimal> for &'a Decimal
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a> Mul<&'a Decimal> for Decimal
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<'a, 'b> Mul<&'a Decimal> for &'b Decimal
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl Div<Decimal> for Decimal
[src]

The resulting type after applying the / operator.

[src]

Returns Ok(Decimal) if result is finite Err otherwise

impl<'a> Div<Decimal> for &'a Decimal
[src]

The resulting type after applying the / operator.

[src]

Returns Ok(Decimal) if result is finite Err otherwise

impl<'a> Div<&'a Decimal> for Decimal
[src]

The resulting type after applying the / operator.

[src]

Returns Ok(Decimal) if result is finite Err otherwise

impl<'a, 'b> Div<&'a Decimal> for &'b Decimal
[src]

The resulting type after applying the / operator.

[src]

Returns Ok(Decimal) if result is finite Err otherwise

impl Rem<Decimal> for Decimal
[src]

The resulting type after applying the % operator.

[src]

Returns Ok(Decimal) if result is finite Err otherwise

impl<'a> Rem<Decimal> for &'a Decimal
[src]

The resulting type after applying the % operator.

[src]

Returns Ok(Decimal) if result is finite Err otherwise

impl<'a> Rem<&'a Decimal> for Decimal
[src]

The resulting type after applying the % operator.

[src]

Returns Ok(Decimal) if result is finite Err otherwise

impl<'a, 'b> Rem<&'a Decimal> for &'b Decimal
[src]

The resulting type after applying the % operator.

[src]

Returns Ok(Decimal) if result is finite Err otherwise

impl AddAssign<Decimal> for Decimal
[src]

[src]

Performs the += operation.

impl SubAssign<Decimal> for Decimal
[src]

[src]

Performs the -= operation.

impl MulAssign<Decimal> for Decimal
[src]

[src]

Performs the *= operation.

impl<T> Sum<T> for Decimal where
    T: Borrow<Decimal>, 
[src]

[src]

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

impl Serialize for Decimal
[src]

[src]

Serialize this value into the given Serde serializer. Read more

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

[src]

Deserialize this value from the given Serde deserializer. Read more