Struct sqlx::types::BigDecimal [−]
pub struct BigDecimal { /* fields omitted */ }
Expand description
A big decimal type.
Implementations
impl BigDecimal
impl BigDecimal
pub fn new(digits: BigInt, scale: i64) -> BigDecimal
pub fn new(digits: BigInt, scale: i64) -> BigDecimal
Creates and initializes a BigDecimal
.
pub fn parse_bytes(buf: &[u8], radix: u32) -> Option<BigDecimal>
pub fn parse_bytes(buf: &[u8], radix: u32) -> Option<BigDecimal>
Creates and initializes a BigDecimal
.
Decodes using str::from_utf8
and forwards to BigDecimal::from_str_radix
.
Only base-10 is supported.
Examples
use bigdecimal::{BigDecimal, Zero};
assert_eq!(BigDecimal::parse_bytes(b"0", 10).unwrap(), BigDecimal::zero());
assert_eq!(BigDecimal::parse_bytes(b"13", 10).unwrap(), BigDecimal::from(13));
pub fn with_scale(&self, new_scale: i64) -> BigDecimal
pub 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 (indicating a larger power of 10), digits will be dropped (as precision is lower)
pub fn with_prec(&self, prec: u64) -> BigDecimal
pub fn with_prec(&self, prec: u64) -> BigDecimal
Return a new BigDecimal object with precision set to new value
Return the sign of the BigDecimal
as num::bigint::Sign
.
Examples
extern crate num_bigint;
extern crate bigdecimal;
use std::str::FromStr;
assert_eq!(bigdecimal::BigDecimal::from_str("-1").unwrap().sign(), num_bigint::Sign::Minus);
assert_eq!(bigdecimal::BigDecimal::from_str("0").unwrap().sign(), num_bigint::Sign::NoSign);
assert_eq!(bigdecimal::BigDecimal::from_str("1").unwrap().sign(), num_bigint::Sign::Plus);
pub fn as_bigint_and_exponent(&self) -> (BigInt, i64)
pub fn as_bigint_and_exponent(&self) -> (BigInt, i64)
Return the internal big integer value and an exponent. Note that a positive exponent indicates a negative power of 10.
Examples
extern crate num_bigint;
extern crate bigdecimal;
use std::str::FromStr;
assert_eq!(bigdecimal::BigDecimal::from_str("1.1").unwrap().as_bigint_and_exponent(),
(num_bigint::BigInt::from_str("11").unwrap(), 1));
pub fn into_bigint_and_exponent(self) -> (BigInt, i64)
pub fn into_bigint_and_exponent(self) -> (BigInt, i64)
Convert into the internal big integer value and an exponent. Note that a positive exponent indicates a negative power of 10.
Examples
extern crate num_bigint;
extern crate bigdecimal;
use std::str::FromStr;
assert_eq!(bigdecimal::BigDecimal::from_str("1.1").unwrap().into_bigint_and_exponent(),
(num_bigint::BigInt::from_str("11").unwrap(), 1));
pub fn abs(&self) -> BigDecimal
pub fn abs(&self) -> BigDecimal
Compute the absolute value of number
pub fn double(&self) -> BigDecimal
pub fn half(&self) -> BigDecimal
pub fn half(&self) -> BigDecimal
Divide this efficiently by 2
Note, if this is odd, the precision will increase by 1, regardless of the context’s limit.
pub fn square(&self) -> BigDecimal
pub fn square(&self) -> BigDecimal
pub fn cube(&self) -> BigDecimal
pub fn sqrt(&self) -> Option<BigDecimal>
pub fn sqrt(&self) -> Option<BigDecimal>
Take the square root of the number
If the value is < 0, None is returned
pub fn cbrt(&self) -> BigDecimal
pub fn cbrt(&self) -> BigDecimal
Take the cube root of the number
pub fn inverse(&self) -> BigDecimal
pub fn inverse(&self) -> BigDecimal
Compute the reciprical of the number: x-1
pub fn round(&self, round_digits: i64) -> BigDecimal
pub fn round(&self, round_digits: i64) -> BigDecimal
Return number rounded to round_digits precision after the decimal point
pub fn is_integer(&self) -> bool
pub fn is_integer(&self) -> bool
Return true if this number has zero fractional part (is equal to an integer)
pub fn exp(&self) -> BigDecimal
pub fn exp(&self) -> BigDecimal
Evaluate the natural-exponential function ex
pub fn normalized(&self) -> BigDecimal
Trait Implementations
impl<'a> Add<&'a BigDecimal> for BigDecimal
impl<'a> Add<&'a BigDecimal> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the +
operator.
pub fn add(self, rhs: &'a BigDecimal) -> BigDecimal
pub fn add(self, rhs: &'a BigDecimal) -> BigDecimal
Performs the +
operation. Read more
impl<'a, 'b> Add<&'a BigInt> for &'b BigDecimal
impl<'a, 'b> Add<&'a BigInt> for &'b BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the +
operator.
pub fn add(self, rhs: &BigInt) -> BigDecimal
pub fn add(self, rhs: &BigInt) -> BigDecimal
Performs the +
operation. Read more
impl<'a> Add<&'a BigInt> for BigDecimal
impl<'a> Add<&'a BigInt> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the +
operator.
pub fn add(self, rhs: &BigInt) -> BigDecimal
pub fn add(self, rhs: &BigInt) -> BigDecimal
Performs the +
operation. Read more
impl<'a, 'b> Add<&'b BigDecimal> for &'a BigDecimal
impl<'a, 'b> Add<&'b BigDecimal> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the +
operator.
pub fn add(self, rhs: &BigDecimal) -> BigDecimal
pub fn add(self, rhs: &BigDecimal) -> BigDecimal
Performs the +
operation. Read more
impl Add<BigDecimal> for BigDecimal
impl Add<BigDecimal> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the +
operator.
pub fn add(self, rhs: BigDecimal) -> BigDecimal
pub fn add(self, rhs: BigDecimal) -> BigDecimal
Performs the +
operation. Read more
impl<'a> Add<BigDecimal> for &'a BigDecimal
impl<'a> Add<BigDecimal> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the +
operator.
pub fn add(self, rhs: BigDecimal) -> BigDecimal
pub fn add(self, rhs: BigDecimal) -> BigDecimal
Performs the +
operation. Read more
impl<'a> Add<BigInt> for &'a BigDecimal
impl<'a> Add<BigInt> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the +
operator.
pub fn add(self, rhs: BigInt) -> BigDecimal
pub fn add(self, rhs: BigInt) -> BigDecimal
Performs the +
operation. Read more
impl Add<BigInt> for BigDecimal
impl Add<BigInt> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the +
operator.
pub fn add(self, rhs: BigInt) -> BigDecimal
pub fn add(self, rhs: BigInt) -> BigDecimal
Performs the +
operation. Read more
impl<'a> AddAssign<&'a BigDecimal> for BigDecimal
impl<'a> AddAssign<&'a BigDecimal> for BigDecimal
pub fn add_assign(&mut self, rhs: &BigDecimal)
pub fn add_assign(&mut self, rhs: &BigDecimal)
Performs the +=
operation. Read more
impl<'a> AddAssign<&'a BigInt> for BigDecimal
impl<'a> AddAssign<&'a BigInt> for BigDecimal
pub fn add_assign(&mut self, rhs: &BigInt)
pub fn add_assign(&mut self, rhs: &BigInt)
Performs the +=
operation. Read more
impl AddAssign<BigDecimal> for BigDecimal
impl AddAssign<BigDecimal> for BigDecimal
pub fn add_assign(&mut self, other: BigDecimal)
pub fn add_assign(&mut self, other: BigDecimal)
Performs the +=
operation. Read more
impl<'a> AddAssign<BigInt> for BigDecimal
impl<'a> AddAssign<BigInt> for BigDecimal
pub fn add_assign(&mut self, rhs: BigInt)
pub fn add_assign(&mut self, rhs: BigInt)
Performs the +=
operation. Read more
impl Clone for BigDecimal
impl Clone for BigDecimal
pub fn clone(&self) -> BigDecimal
pub fn clone(&self) -> BigDecimal
Returns a copy of the value. Read more
Performs copy-assignment from source
. Read more
impl Debug for BigDecimal
impl Debug for BigDecimal
pub fn decode(
value: MySqlValueRef<'_>
) -> Result<BigDecimal, Box<dyn Error + Send + Sync + 'static, Global>>
pub fn decode(
value: MySqlValueRef<'_>
) -> Result<BigDecimal, Box<dyn Error + Send + Sync + 'static, Global>>
Decode a new value of this type using a raw value from the database.
pub fn decode(
value: PgValueRef<'_>
) -> Result<BigDecimal, Box<dyn Error + Send + Sync + 'static, Global>>
pub fn decode(
value: PgValueRef<'_>
) -> Result<BigDecimal, Box<dyn Error + Send + Sync + 'static, Global>>
Decode a new value of this type using a raw value from the database.
impl Default for BigDecimal
impl Default for BigDecimal
pub fn default() -> BigDecimal
pub fn default() -> BigDecimal
Returns the “default value” for a type. Read more
impl Display for BigDecimal
impl Display for BigDecimal
impl<'a> Div<&'a BigDecimal> for BigDecimal
impl<'a> Div<&'a BigDecimal> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
pub fn div(self, other: &'a BigDecimal) -> BigDecimal
pub fn div(self, other: &'a BigDecimal) -> BigDecimal
Performs the /
operation. Read more
impl<'a, 'b> Div<&'b BigDecimal> for &'a BigDecimal
impl<'a, 'b> Div<&'b BigDecimal> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
pub fn div(self, other: &BigDecimal) -> BigDecimal
pub fn div(self, other: &BigDecimal) -> BigDecimal
Performs the /
operation. Read more
impl Div<BigDecimal> for BigDecimal
impl Div<BigDecimal> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
pub fn div(self, other: BigDecimal) -> BigDecimal
pub fn div(self, other: BigDecimal) -> BigDecimal
Performs the /
operation. Read more
impl<'a> Div<BigDecimal> for &'a BigDecimal
impl<'a> Div<BigDecimal> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
pub fn div(self, other: BigDecimal) -> BigDecimal
pub fn div(self, other: BigDecimal) -> BigDecimal
Performs the /
operation. Read more
impl<'a> Div<f32> for &'a BigDecimal
impl<'a> Div<f32> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
impl<'a> Div<f64> for &'a BigDecimal
impl<'a> Div<f64> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
impl<'a> Div<i16> for &'a BigDecimal
impl<'a> Div<i16> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
impl<'a> Div<i16> for BigDecimal
impl<'a> Div<i16> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
impl<'a> Div<i32> for BigDecimal
impl<'a> Div<i32> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
impl<'a> Div<i32> for &'a BigDecimal
impl<'a> Div<i32> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
impl<'a> Div<i64> for &'a BigDecimal
impl<'a> Div<i64> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
impl<'a> Div<i64> for BigDecimal
impl<'a> Div<i64> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
impl<'a> Div<i8> for &'a BigDecimal
impl<'a> Div<i8> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
impl<'a> Div<i8> for BigDecimal
impl<'a> Div<i8> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
impl<'a> Div<u16> for &'a BigDecimal
impl<'a> Div<u16> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
impl<'a> Div<u32> for &'a BigDecimal
impl<'a> Div<u32> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
impl<'a> Div<u64> for &'a BigDecimal
impl<'a> Div<u64> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
impl<'a> Div<u8> for &'a BigDecimal
impl<'a> Div<u8> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the /
operator.
Writes the value of self
into buf
without moving self
. Read more
Writes the value of self
into buf
in the expected format for the database.
Panics
If this BigDecimal
cannot be represented by PgNumeric
.
Writes the value of self
into buf
without moving self
. Read more
Writes the value of self
into buf
in the expected format for the database.
impl From<BigInt> for BigDecimal
impl From<BigInt> for BigDecimal
pub fn from(int_val: BigInt) -> BigDecimal
pub fn from(int_val: BigInt) -> BigDecimal
Performs the conversion.
impl From<i16> for BigDecimal
impl From<i16> for BigDecimal
pub fn from(n: i16) -> BigDecimal
pub fn from(n: i16) -> BigDecimal
Performs the conversion.
impl From<i32> for BigDecimal
impl From<i32> for BigDecimal
pub fn from(n: i32) -> BigDecimal
pub fn from(n: i32) -> BigDecimal
Performs the conversion.
impl From<i64> for BigDecimal
impl From<i64> for BigDecimal
pub fn from(n: i64) -> BigDecimal
pub fn from(n: i64) -> BigDecimal
Performs the conversion.
impl From<i8> for BigDecimal
impl From<i8> for BigDecimal
pub fn from(n: i8) -> BigDecimal
pub fn from(n: i8) -> BigDecimal
Performs the conversion.
impl From<u16> for BigDecimal
impl From<u16> for BigDecimal
pub fn from(n: u16) -> BigDecimal
pub fn from(n: u16) -> BigDecimal
Performs the conversion.
impl From<u32> for BigDecimal
impl From<u32> for BigDecimal
pub fn from(n: u32) -> BigDecimal
pub fn from(n: u32) -> BigDecimal
Performs the conversion.
impl From<u64> for BigDecimal
impl From<u64> for BigDecimal
pub fn from(n: u64) -> BigDecimal
pub fn from(n: u64) -> BigDecimal
Performs the conversion.
impl From<u8> for BigDecimal
impl From<u8> for BigDecimal
pub fn from(n: u8) -> BigDecimal
pub fn from(n: u8) -> BigDecimal
Performs the conversion.
impl FromPrimitive for BigDecimal
impl FromPrimitive for BigDecimal
pub fn from_i64(n: i64) -> Option<BigDecimal>
pub fn from_i64(n: i64) -> Option<BigDecimal>
Converts an i64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
pub fn from_u64(n: u64) -> Option<BigDecimal>
pub fn from_u64(n: u64) -> Option<BigDecimal>
Converts an u64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
pub fn from_f32(n: f32) -> Option<BigDecimal>
pub fn from_f32(n: f32) -> Option<BigDecimal>
Converts a f32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
pub fn from_f64(n: f64) -> Option<BigDecimal>
pub fn from_f64(n: f64) -> Option<BigDecimal>
Converts a f64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an isize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an i8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an i16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an i32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an i128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts a usize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an u8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an u16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
Converts an u32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
impl FromStr for BigDecimal
impl FromStr for BigDecimal
impl Hash for BigDecimal
impl Hash for BigDecimal
impl<'a> Mul<&'a BigDecimal> for BigDecimal
impl<'a> Mul<&'a BigDecimal> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the *
operator.
pub fn mul(self, rhs: &'a BigDecimal) -> BigDecimal
pub fn mul(self, rhs: &'a BigDecimal) -> BigDecimal
Performs the *
operation. Read more
impl<'a> Mul<&'a BigInt> for BigDecimal
impl<'a> Mul<&'a BigInt> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the *
operator.
pub fn mul(self, rhs: &BigInt) -> BigDecimal
pub fn mul(self, rhs: &BigInt) -> BigDecimal
Performs the *
operation. Read more
impl<'a, 'b> Mul<&'a BigInt> for &'b BigDecimal
impl<'a, 'b> Mul<&'a BigInt> for &'b BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the *
operator.
pub fn mul(self, rhs: &BigInt) -> BigDecimal
pub fn mul(self, rhs: &BigInt) -> BigDecimal
Performs the *
operation. Read more
impl<'a, 'b> Mul<&'b BigDecimal> for &'a BigDecimal
impl<'a, 'b> Mul<&'b BigDecimal> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the *
operator.
pub fn mul(self, rhs: &BigDecimal) -> BigDecimal
pub fn mul(self, rhs: &BigDecimal) -> BigDecimal
Performs the *
operation. Read more
impl Mul<BigDecimal> for BigDecimal
impl Mul<BigDecimal> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the *
operator.
pub fn mul(self, rhs: BigDecimal) -> BigDecimal
pub fn mul(self, rhs: BigDecimal) -> BigDecimal
Performs the *
operation. Read more
impl<'a> Mul<BigDecimal> for &'a BigDecimal
impl<'a> Mul<BigDecimal> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the *
operator.
pub fn mul(self, rhs: BigDecimal) -> BigDecimal
pub fn mul(self, rhs: BigDecimal) -> BigDecimal
Performs the *
operation. Read more
impl<'a> Mul<BigInt> for &'a BigDecimal
impl<'a> Mul<BigInt> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the *
operator.
pub fn mul(self, rhs: BigInt) -> BigDecimal
pub fn mul(self, rhs: BigInt) -> BigDecimal
Performs the *
operation. Read more
impl Mul<BigInt> for BigDecimal
impl Mul<BigInt> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the *
operator.
pub fn mul(self, rhs: BigInt) -> BigDecimal
pub fn mul(self, rhs: BigInt) -> BigDecimal
Performs the *
operation. Read more
impl<'a> MulAssign<&'a BigDecimal> for BigDecimal
impl<'a> MulAssign<&'a BigDecimal> for BigDecimal
pub fn mul_assign(&mut self, rhs: &BigDecimal)
pub fn mul_assign(&mut self, rhs: &BigDecimal)
Performs the *=
operation. Read more
impl MulAssign<BigDecimal> for BigDecimal
impl MulAssign<BigDecimal> for BigDecimal
pub fn mul_assign(&mut self, other: BigDecimal)
pub fn mul_assign(&mut self, other: BigDecimal)
Performs the *=
operation. Read more
impl<'a> Neg for &'a BigDecimal
impl<'a> Neg for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the -
operator.
pub fn neg(self) -> BigDecimal
pub fn neg(self) -> BigDecimal
Performs the unary -
operation. Read more
impl Neg for BigDecimal
impl Neg for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the -
operator.
pub fn neg(self) -> BigDecimal
pub fn neg(self) -> BigDecimal
Performs the unary -
operation. Read more
impl Num for BigDecimal
impl Num for BigDecimal
pub fn from_str_radix(
s: &str,
radix: u32
) -> Result<BigDecimal, ParseBigDecimalError>
pub fn from_str_radix(
s: &str,
radix: u32
) -> Result<BigDecimal, ParseBigDecimalError>
Creates and initializes a BigDecimal.
type FromStrRadixErr = ParseBigDecimalError
impl One for BigDecimal
impl One for BigDecimal
pub fn one() -> BigDecimal
pub fn one() -> BigDecimal
Returns the multiplicative identity element of Self
, 1
. Read more
impl Ord for BigDecimal
impl Ord for BigDecimal
pub fn cmp(&self, other: &BigDecimal) -> Ordering
pub fn cmp(&self, other: &BigDecimal) -> Ordering
Complete ordering implementation for BigDecimal
Example
use std::str::FromStr;
let a = bigdecimal::BigDecimal::from_str("-1").unwrap();
let b = bigdecimal::BigDecimal::from_str("1").unwrap();
assert!(a < b);
assert!(b > a);
let c = bigdecimal::BigDecimal::from_str("1").unwrap();
assert!(b >= c);
assert!(c >= b);
let d = bigdecimal::BigDecimal::from_str("10.0").unwrap();
assert!(d > c);
let e = bigdecimal::BigDecimal::from_str(".5").unwrap();
assert!(e < c);
Compares and returns the maximum of two values. Read more
Compares and returns the minimum of two values. Read more
impl PartialEq<BigDecimal> for BigDecimal
impl PartialEq<BigDecimal> for BigDecimal
impl PartialOrd<BigDecimal> for BigDecimal
impl PartialOrd<BigDecimal> for BigDecimal
pub fn partial_cmp(&self, other: &BigDecimal) -> Option<Ordering>
pub fn partial_cmp(&self, other: &BigDecimal) -> Option<Ordering>
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
impl<'a> Rem<&'a BigDecimal> for BigDecimal
impl<'a> Rem<&'a BigDecimal> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the %
operator.
pub fn rem(self, other: &BigDecimal) -> BigDecimal
pub fn rem(self, other: &BigDecimal) -> BigDecimal
Performs the %
operation. Read more
impl<'a, 'b> Rem<&'b BigDecimal> for &'a BigDecimal
impl<'a, 'b> Rem<&'b BigDecimal> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the %
operator.
pub fn rem(self, other: &BigDecimal) -> BigDecimal
pub fn rem(self, other: &BigDecimal) -> BigDecimal
Performs the %
operation. Read more
impl Rem<BigDecimal> for BigDecimal
impl Rem<BigDecimal> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the %
operator.
pub fn rem(self, other: BigDecimal) -> BigDecimal
pub fn rem(self, other: BigDecimal) -> BigDecimal
Performs the %
operation. Read more
impl<'a> Rem<BigDecimal> for &'a BigDecimal
impl<'a> Rem<BigDecimal> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the %
operator.
pub fn rem(self, other: BigDecimal) -> BigDecimal
pub fn rem(self, other: BigDecimal) -> BigDecimal
Performs the %
operation. Read more
impl Signed for BigDecimal
impl Signed for BigDecimal
pub fn abs(&self) -> BigDecimal
pub fn abs(&self) -> BigDecimal
Computes the absolute value. Read more
pub fn abs_sub(&self, other: &BigDecimal) -> BigDecimal
pub fn abs_sub(&self, other: &BigDecimal) -> BigDecimal
The positive difference of two numbers. Read more
pub fn signum(&self) -> BigDecimal
pub fn signum(&self) -> BigDecimal
Returns the sign of the number. Read more
pub fn is_positive(&self) -> bool
pub fn is_positive(&self) -> bool
Returns true if the number is positive and false if the number is zero or negative.
pub fn is_negative(&self) -> bool
pub fn is_negative(&self) -> bool
Returns true if the number is negative and false if the number is zero or positive.
impl<'a> Sub<&'a BigDecimal> for BigDecimal
impl<'a> Sub<&'a BigDecimal> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the -
operator.
pub fn sub(self, rhs: &BigDecimal) -> BigDecimal
pub fn sub(self, rhs: &BigDecimal) -> BigDecimal
Performs the -
operation. Read more
impl<'a, 'b> Sub<&'a BigInt> for &'b BigDecimal
impl<'a, 'b> Sub<&'a BigInt> for &'b BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the -
operator.
pub fn sub(self, rhs: &BigInt) -> BigDecimal
pub fn sub(self, rhs: &BigInt) -> BigDecimal
Performs the -
operation. Read more
impl<'a> Sub<&'a BigInt> for BigDecimal
impl<'a> Sub<&'a BigInt> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the -
operator.
pub fn sub(self, rhs: &BigInt) -> BigDecimal
pub fn sub(self, rhs: &BigInt) -> BigDecimal
Performs the -
operation. Read more
impl<'a, 'b> Sub<&'b BigDecimal> for &'a BigDecimal
impl<'a, 'b> Sub<&'b BigDecimal> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the -
operator.
pub fn sub(self, rhs: &BigDecimal) -> BigDecimal
pub fn sub(self, rhs: &BigDecimal) -> BigDecimal
Performs the -
operation. Read more
impl Sub<BigDecimal> for BigDecimal
impl Sub<BigDecimal> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the -
operator.
pub fn sub(self, rhs: BigDecimal) -> BigDecimal
pub fn sub(self, rhs: BigDecimal) -> BigDecimal
Performs the -
operation. Read more
impl<'a> Sub<BigDecimal> for &'a BigDecimal
impl<'a> Sub<BigDecimal> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the -
operator.
pub fn sub(self, rhs: BigDecimal) -> BigDecimal
pub fn sub(self, rhs: BigDecimal) -> BigDecimal
Performs the -
operation. Read more
impl<'a> Sub<BigInt> for &'a BigDecimal
impl<'a> Sub<BigInt> for &'a BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the -
operator.
pub fn sub(self, rhs: BigInt) -> BigDecimal
pub fn sub(self, rhs: BigInt) -> BigDecimal
Performs the -
operation. Read more
impl Sub<BigInt> for BigDecimal
impl Sub<BigInt> for BigDecimal
type Output = BigDecimal
type Output = BigDecimal
The resulting type after applying the -
operator.
pub fn sub(self, rhs: BigInt) -> BigDecimal
pub fn sub(self, rhs: BigInt) -> BigDecimal
Performs the -
operation. Read more
impl<'a> SubAssign<&'a BigDecimal> for BigDecimal
impl<'a> SubAssign<&'a BigDecimal> for BigDecimal
pub fn sub_assign(&mut self, rhs: &BigDecimal)
pub fn sub_assign(&mut self, rhs: &BigDecimal)
Performs the -=
operation. Read more
impl<'a> SubAssign<&'a BigInt> for BigDecimal
impl<'a> SubAssign<&'a BigInt> for BigDecimal
pub fn sub_assign(&mut self, rhs: &BigInt)
pub fn sub_assign(&mut self, rhs: &BigInt)
Performs the -=
operation. Read more
impl SubAssign<BigDecimal> for BigDecimal
impl SubAssign<BigDecimal> for BigDecimal
pub fn sub_assign(&mut self, other: BigDecimal)
pub fn sub_assign(&mut self, other: BigDecimal)
Performs the -=
operation. Read more
impl<'a> SubAssign<BigInt> for BigDecimal
impl<'a> SubAssign<BigInt> for BigDecimal
pub fn sub_assign(&mut self, rhs: BigInt)
pub fn sub_assign(&mut self, rhs: BigInt)
Performs the -=
operation. Read more
impl<'a> Sum<&'a BigDecimal> for BigDecimal
impl<'a> Sum<&'a BigDecimal> for BigDecimal
pub fn sum<I>(iter: I) -> BigDecimal where
I: Iterator<Item = &'a BigDecimal>,
pub fn sum<I>(iter: I) -> BigDecimal where
I: Iterator<Item = &'a BigDecimal>,
Method which takes an iterator and generates Self
from the elements by
“summing up” the items. Read more
impl Sum<BigDecimal> for BigDecimal
impl Sum<BigDecimal> for BigDecimal
pub fn sum<I>(iter: I) -> BigDecimal where
I: Iterator<Item = BigDecimal>,
pub fn sum<I>(iter: I) -> BigDecimal where
I: Iterator<Item = BigDecimal>,
Method which takes an iterator and generates Self
from the elements by
“summing up” the items. Read more
impl ToBigInt for BigDecimal
impl ToBigInt for BigDecimal
impl ToPrimitive for BigDecimal
impl ToPrimitive for BigDecimal
Converts the value of self
to an i64
. If the value cannot be
represented by an i64
, then None
is returned. Read more
Converts the value of self
to a u64
. If the value cannot be
represented by a u64
, then None
is returned. Read more
Converts the value of self
to an f64
. Overflows may map to positive
or negative inifinity, otherwise None
is returned if the value cannot
be represented by an f64
. Read more
Converts the value of self
to an isize
. If the value cannot be
represented by an isize
, then None
is returned. Read more
Converts the value of self
to an i8
. If the value cannot be
represented by an i8
, then None
is returned. Read more
Converts the value of self
to an i16
. If the value cannot be
represented by an i16
, then None
is returned. Read more
Converts the value of self
to an i32
. If the value cannot be
represented by an i32
, then None
is returned. Read more
Converts the value of self
to an i128
. If the value cannot be
represented by an i128
(i64
under the default implementation), then
None
is returned. Read more
Converts the value of self
to a usize
. If the value cannot be
represented by a usize
, then None
is returned. Read more
Converts the value of self
to a u8
. If the value cannot be
represented by a u8
, then None
is returned. Read more
Converts the value of self
to a u16
. If the value cannot be
represented by a u16
, then None
is returned. Read more
Converts the value of self
to a u32
. If the value cannot be
represented by a u32
, then None
is returned. Read more
Converts the value of self
to a u128
. If the value cannot be
represented by a u128
(u64
under the default implementation), then
None
is returned. Read more
impl TryFrom<f32> for BigDecimal
impl TryFrom<f32> for BigDecimal
type Error = ParseBigDecimalError
type Error = ParseBigDecimalError
The type returned in the event of a conversion error.
pub fn try_from(
n: f32
) -> Result<BigDecimal, <BigDecimal as TryFrom<f32>>::Error>
pub fn try_from(
n: f32
) -> Result<BigDecimal, <BigDecimal as TryFrom<f32>>::Error>
Performs the conversion.
impl TryFrom<f64> for BigDecimal
impl TryFrom<f64> for BigDecimal
type Error = ParseBigDecimalError
type Error = ParseBigDecimalError
The type returned in the event of a conversion error.
pub fn try_from(
n: f64
) -> Result<BigDecimal, <BigDecimal as TryFrom<f64>>::Error>
pub fn try_from(
n: f64
) -> Result<BigDecimal, <BigDecimal as TryFrom<f64>>::Error>
Performs the conversion.
Returns the canonical SQL type for this Rust type. Read more
Returns the canonical SQL type for this Rust type. Read more
impl Zero for BigDecimal
impl Zero for BigDecimal
impl Eq for BigDecimal
impl StructuralEq for BigDecimal
Auto Trait Implementations
impl RefUnwindSafe for BigDecimal
impl Send for BigDecimal
impl Sync for BigDecimal
impl Unpin for BigDecimal
impl UnwindSafe for BigDecimal
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.