Struct bigdecimal::BigDecimal
[−]
[src]
pub struct BigDecimal { /* fields omitted */ }
A big decimal type.
Methods
impl BigDecimal
[src]
fn new(digits: BigInt, scale: i64) -> BigDecimal
Creates and initializes a BigDecimal
.
fn parse_bytes(buf: &[u8], radix: u32) -> Option<BigDecimal>
Creates and initializes a BigDecimal
.
Examples
// assert_eq!(BigDecimal::parse_bytes(b"0", 16), BigDecimal::zero()); // assert_eq!(BigDecimal::parse_bytes(b"f", 16), BigDecimal::parse_bytes(b"16", 10));
fn with_scale(&self, new_scale: i64) -> BigDecimal
Return a new BigDecimal object equivalent to self, with internal scaling set to the number specified. If the new_scale is lower than the current value, digits will be dropped.
Trait Implementations
impl Clone for BigDecimal
[src]
fn clone(&self) -> BigDecimal
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Debug for BigDecimal
[src]
impl Hash for BigDecimal
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the state given, updating the hasher as necessary.
fn hash_slice<H>(data: &[Self], state: &mut H) where H: Hasher
1.3.0
Feeds a slice of this type into the state provided.
impl FromStr for BigDecimal
[src]
type Err = ParseBigDecimalError
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<BigDecimal, ParseBigDecimalError>
Parses a string s
to return a value of this type. Read more
impl PartialEq for BigDecimal
[src]
fn eq(&self, rhs: &BigDecimal) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0
This method tests for !=
.
impl Default for BigDecimal
[src]
fn default() -> BigDecimal
Returns the "default value" for a type. Read more
impl Zero for BigDecimal
[src]
fn zero() -> BigDecimal
Returns the additive identity element of Self
, 0
. Read more
fn is_zero(&self) -> bool
Returns true
if self
is equal to the additive identity.
impl One for BigDecimal
[src]
fn one() -> BigDecimal
Returns the multiplicative identity element of Self
, 1
. Read more
impl Add<BigDecimal> for BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the +
operator
fn add(self, other: BigDecimal) -> BigDecimal
The method for the +
operator
impl<'a> Add<&'a BigDecimal> for BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the +
operator
fn add(self, other: &BigDecimal) -> BigDecimal
The method for the +
operator
impl<'a> Add<BigDecimal> for &'a BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the +
operator
fn add(self, other: BigDecimal) -> BigDecimal
The method for the +
operator
impl<'a, 'b> Add<&'b BigDecimal> for &'a BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the +
operator
fn add(self, rhs: &BigDecimal) -> BigDecimal
The method for the +
operator
impl Sub<BigDecimal> for BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the -
operator
fn sub(self, other: BigDecimal) -> BigDecimal
The method for the -
operator
impl<'a> Sub<&'a BigDecimal> for BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the -
operator
fn sub(self, other: &BigDecimal) -> BigDecimal
The method for the -
operator
impl<'a> Sub<BigDecimal> for &'a BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the -
operator
fn sub(self, other: BigDecimal) -> BigDecimal
The method for the -
operator
impl<'a, 'b> Sub<&'b BigDecimal> for &'a BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the -
operator
fn sub(self, rhs: &BigDecimal) -> BigDecimal
The method for the -
operator
impl Mul<BigDecimal> for BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the *
operator
fn mul(self, other: BigDecimal) -> BigDecimal
The method for the *
operator
impl<'a> Mul<&'a BigDecimal> for BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the *
operator
fn mul(self, other: &BigDecimal) -> BigDecimal
The method for the *
operator
impl<'a> Mul<BigDecimal> for &'a BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the *
operator
fn mul(self, other: BigDecimal) -> BigDecimal
The method for the *
operator
impl<'a, 'b> Mul<&'b BigDecimal> for &'a BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the *
operator
fn mul(self, rhs: &BigDecimal) -> BigDecimal
The method for the *
operator
impl Div<BigDecimal> for BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the /
operator
fn div(self, other: BigDecimal) -> BigDecimal
The method for the /
operator
impl<'a> Div<&'a BigDecimal> for BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the /
operator
fn div(self, other: &BigDecimal) -> BigDecimal
The method for the /
operator
impl<'a> Div<BigDecimal> for &'a BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the /
operator
fn div(self, other: BigDecimal) -> BigDecimal
The method for the /
operator
impl<'a, 'b> Div<&'b BigDecimal> for &'a BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the /
operator
fn div(self, other: &BigDecimal) -> BigDecimal
The method for the /
operator
impl Rem<BigDecimal> for BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the %
operator
fn rem(self, other: BigDecimal) -> BigDecimal
The method for the %
operator
impl<'a> Rem<&'a BigDecimal> for BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the %
operator
fn rem(self, other: &BigDecimal) -> BigDecimal
The method for the %
operator
impl<'a> Rem<BigDecimal> for &'a BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the %
operator
fn rem(self, other: BigDecimal) -> BigDecimal
The method for the %
operator
impl<'a, 'b> Rem<&'b BigDecimal> for &'a BigDecimal
[src]
type Output = BigDecimal
The resulting type after applying the %
operator
fn rem(self, _: &BigDecimal) -> BigDecimal
The method for the %
operator
impl Display for BigDecimal
[src]
impl Num for BigDecimal
[src]
type FromStrRadixErr = ParseBigDecimalError
fn from_str_radix(s: &str,
radix: u32)
-> Result<BigDecimal, ParseBigDecimalError>
radix: u32)
-> Result<BigDecimal, ParseBigDecimalError>
Creates and initializes a BigDecimal.