Struct sqlx::types::BigDecimal[]

pub struct BigDecimal { /* fields omitted */ }
Expand description

A big decimal type.

Implementations

impl BigDecimal

pub fn new(digits: BigInt, scale: i64) -> BigDecimal

Creates and initializes a 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

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

Return a new BigDecimal object with precision set to new value

pub fn sign(&self) -> Sign

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)

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)

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 digits(&self) -> u64

Number of digits in the non-scaled integer representation

pub fn abs(&self) -> BigDecimal

Compute the absolute value of number

pub fn double(&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 cube(&self) -> 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

Take the cube root of the number

pub fn inverse(&self) -> BigDecimal

Compute the reciprical of the number: x-1

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

Return true if this number has zero fractional part (is equal to an integer)

pub fn exp(&self) -> BigDecimal

Evaluate the natural-exponential function ex

#[must_use]
pub fn normalized(&self) -> BigDecimal

Trait Implementations

impl<'a> Add<&'a BigDecimal> for BigDecimal

type Output = BigDecimal

The resulting type after applying the + operator.

pub fn add(self, rhs: &'a BigDecimal) -> BigDecimal

Performs the + operation. Read more

impl<'a> Add<&'a BigInt> for BigDecimal

type Output = BigDecimal

The resulting type after applying the + operator.

pub fn add(self, rhs: &BigInt) -> BigDecimal

Performs the + operation. Read more

impl<'a, 'b> Add<&'a BigInt> for &'b BigDecimal

type Output = BigDecimal

The resulting type after applying the + operator.

pub fn add(self, rhs: &BigInt) -> BigDecimal

Performs the + operation. Read more

impl<'a, 'b> Add<&'b BigDecimal> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the + operator.

pub fn add(self, rhs: &BigDecimal) -> BigDecimal

Performs the + operation. Read more

impl Add<BigDecimal> for BigDecimal

type Output = BigDecimal

The resulting type after applying the + operator.

pub fn add(self, rhs: BigDecimal) -> BigDecimal

Performs the + operation. Read more

impl<'a> Add<BigDecimal> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the + operator.

pub fn add(self, rhs: BigDecimal) -> BigDecimal

Performs the + operation. Read more

impl<'a> Add<BigInt> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the + operator.

pub fn add(self, rhs: BigInt) -> BigDecimal

Performs the + operation. Read more

impl Add<BigInt> for BigDecimal

type Output = BigDecimal

The resulting type after applying the + operator.

pub fn add(self, rhs: BigInt) -> BigDecimal

Performs the + operation. Read more

impl<'a> AddAssign<&'a BigDecimal> for BigDecimal

pub fn add_assign(&mut self, rhs: &BigDecimal)

Performs the += operation. Read more

impl<'a> AddAssign<&'a BigInt> for BigDecimal

pub fn add_assign(&mut self, rhs: &BigInt)

Performs the += operation. Read more

impl AddAssign<BigDecimal> for BigDecimal

pub fn add_assign(&mut self, other: BigDecimal)

Performs the += operation. Read more

impl<'a> AddAssign<BigInt> for BigDecimal

pub fn add_assign(&mut self, rhs: BigInt)

Performs the += operation. Read more

impl Clone for BigDecimal

pub fn clone(&self) -> BigDecimal

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for BigDecimal

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl<'_> Decode<'_, MySql> for BigDecimal[src]

pub fn decode(
    value: MySqlValueRef<'_>
) -> Result<BigDecimal, Box<dyn Error + 'static + Sync + Send, Global>>
[src]

Decode a new value of this type using a raw value from the database.

impl<'_> Decode<'_, Postgres> for BigDecimal[src]

pub fn decode(
    value: PgValueRef<'_>
) -> Result<BigDecimal, Box<dyn Error + 'static + Sync + Send, Global>>
[src]

Decode a new value of this type using a raw value from the database.

impl Default for BigDecimal

pub fn default() -> BigDecimal

Returns the “default value” for a type. Read more

impl Display for BigDecimal

pub fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more

impl<'a> Div<&'a BigDecimal> for BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, other: &'a BigDecimal) -> BigDecimal

Performs the / operation. Read more

impl<'a, 'b> Div<&'b BigDecimal> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, other: &BigDecimal) -> BigDecimal

Performs the / operation. Read more

impl Div<BigDecimal> for BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, other: BigDecimal) -> BigDecimal

Performs the / operation. Read more

impl<'a> Div<BigDecimal> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, other: BigDecimal) -> BigDecimal

Performs the / operation. Read more

impl<'a> Div<f32> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, den: f32) -> <&'a BigDecimal as Div<f32>>::Output

Performs the / operation. Read more

impl<'a> Div<f64> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, den: f64) -> <&'a BigDecimal as Div<f64>>::Output

Performs the / operation. Read more

impl<'a> Div<i16> for BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, den: i16) -> <BigDecimal as Div<i16>>::Output

Performs the / operation. Read more

impl<'a> Div<i16> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, den: i16) -> <&'a BigDecimal as Div<i16>>::Output

Performs the / operation. Read more

impl<'a> Div<i32> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, den: i32) -> <&'a BigDecimal as Div<i32>>::Output

Performs the / operation. Read more

impl<'a> Div<i32> for BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, den: i32) -> <BigDecimal as Div<i32>>::Output

Performs the / operation. Read more

impl<'a> Div<i64> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, den: i64) -> <&'a BigDecimal as Div<i64>>::Output

Performs the / operation. Read more

impl<'a> Div<i64> for BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, den: i64) -> <BigDecimal as Div<i64>>::Output

Performs the / operation. Read more

impl<'a> Div<i8> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, den: i8) -> <&'a BigDecimal as Div<i8>>::Output

Performs the / operation. Read more

impl<'a> Div<i8> for BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, den: i8) -> <BigDecimal as Div<i8>>::Output

Performs the / operation. Read more

impl<'a> Div<u16> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, den: u16) -> <&'a BigDecimal as Div<u16>>::Output

Performs the / operation. Read more

impl<'a> Div<u32> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, den: u32) -> <&'a BigDecimal as Div<u32>>::Output

Performs the / operation. Read more

impl<'a> Div<u64> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, den: u64) -> <&'a BigDecimal as Div<u64>>::Output

Performs the / operation. Read more

impl<'a> Div<u8> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the / operator.

pub fn div(self, den: u8) -> <&'a BigDecimal as Div<u8>>::Output

Performs the / operation. Read more

impl<'_> Encode<'_, MySql> for BigDecimal[src]

pub fn encode_by_ref(&self, buf: &mut Vec<u8, Global>) -> IsNull[src]

Writes the value of self into buf without moving self. Read more

#[must_use]
fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull
[src]

Writes the value of self into buf in the expected format for the database.

fn produces(&self) -> Option<<DB as Database>::TypeInfo>[src]

fn size_hint(&self) -> usize[src]

impl<'_> Encode<'_, Postgres> for BigDecimal[src]

Panics

If this BigDecimal cannot be represented by PgNumeric.

pub fn encode_by_ref(&self, buf: &mut PgArgumentBuffer) -> IsNull[src]

Writes the value of self into buf without moving self. Read more

pub fn size_hint(&self) -> usize[src]

#[must_use]
fn encode(self, buf: &mut <DB as HasArguments<'q>>::ArgumentBuffer) -> IsNull
[src]

Writes the value of self into buf in the expected format for the database.

fn produces(&self) -> Option<<DB as Database>::TypeInfo>[src]

impl From<(BigInt, i64)> for BigDecimal

pub fn from((BigInt, i64)) -> BigDecimal

Performs the conversion.

impl From<BigInt> for BigDecimal

pub fn from(int_val: BigInt) -> BigDecimal

Performs the conversion.

impl From<i16> for BigDecimal

pub fn from(n: i16) -> BigDecimal

Performs the conversion.

impl From<i32> for BigDecimal

pub fn from(n: i32) -> BigDecimal

Performs the conversion.

impl From<i64> for BigDecimal

pub fn from(n: i64) -> BigDecimal

Performs the conversion.

impl From<i8> for BigDecimal

pub fn from(n: i8) -> BigDecimal

Performs the conversion.

impl From<u16> for BigDecimal

pub fn from(n: u16) -> BigDecimal

Performs the conversion.

impl From<u32> for BigDecimal

pub fn from(n: u32) -> BigDecimal

Performs the conversion.

impl From<u64> for BigDecimal

pub fn from(n: u64) -> BigDecimal

Performs the conversion.

impl From<u8> for BigDecimal

pub fn from(n: u8) -> BigDecimal

Performs the conversion.

impl FromPrimitive for 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>

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>

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>

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

fn from_isize(n: isize) -> Option<Self>[src]

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

fn from_i8(n: i8) -> Option<Self>[src]

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

fn from_i16(n: i16) -> Option<Self>[src]

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

fn from_i32(n: i32) -> Option<Self>[src]

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

fn from_i128(n: i128) -> Option<Self>[src]

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

fn from_usize(n: usize) -> Option<Self>[src]

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

fn from_u8(n: u8) -> Option<Self>[src]

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

fn from_u16(n: u16) -> Option<Self>[src]

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

fn from_u32(n: u32) -> Option<Self>[src]

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

fn from_u128(n: u128) -> Option<Self>[src]

Converts an u128 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

type Err = ParseBigDecimalError

The associated error which can be returned from parsing.

pub fn from_str(s: &str) -> Result<BigDecimal, ParseBigDecimalError>

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

impl Hash for BigDecimal

pub fn hash<H>(&self, state: &mut H) where
    H: Hasher

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

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

impl<'a> Mul<&'a BigDecimal> for BigDecimal

type Output = BigDecimal

The resulting type after applying the * operator.

pub fn mul(self, rhs: &'a BigDecimal) -> BigDecimal

Performs the * operation. Read more

impl<'a> Mul<&'a BigInt> for BigDecimal

type Output = BigDecimal

The resulting type after applying the * operator.

pub fn mul(self, rhs: &BigInt) -> BigDecimal

Performs the * operation. Read more

impl<'a, 'b> Mul<&'a BigInt> for &'b BigDecimal

type Output = BigDecimal

The resulting type after applying the * operator.

pub fn mul(self, rhs: &BigInt) -> BigDecimal

Performs the * operation. Read more

impl<'a, 'b> Mul<&'b BigDecimal> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the * operator.

pub fn mul(self, rhs: &BigDecimal) -> BigDecimal

Performs the * operation. Read more

impl<'a> Mul<BigDecimal> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the * operator.

pub fn mul(self, rhs: BigDecimal) -> BigDecimal

Performs the * operation. Read more

impl Mul<BigDecimal> for BigDecimal

type Output = BigDecimal

The resulting type after applying the * operator.

pub fn mul(self, rhs: BigDecimal) -> BigDecimal

Performs the * operation. Read more

impl<'a> Mul<BigInt> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the * operator.

pub fn mul(self, rhs: BigInt) -> BigDecimal

Performs the * operation. Read more

impl Mul<BigInt> for BigDecimal

type Output = BigDecimal

The resulting type after applying the * operator.

pub fn mul(self, rhs: BigInt) -> BigDecimal

Performs the * operation. Read more

impl<'a> MulAssign<&'a BigDecimal> for BigDecimal

pub fn mul_assign(&mut self, rhs: &BigDecimal)

Performs the *= operation. Read more

impl MulAssign<BigDecimal> for BigDecimal

pub fn mul_assign(&mut self, other: BigDecimal)

Performs the *= operation. Read more

impl Neg for BigDecimal

type Output = BigDecimal

The resulting type after applying the - operator.

pub fn neg(self) -> BigDecimal

Performs the unary - operation. Read more

impl<'a> Neg for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the - operator.

pub fn neg(self) -> BigDecimal

Performs the unary - operation. Read more

impl Num for BigDecimal

pub fn from_str_radix(
    s: &str,
    radix: u32
) -> Result<BigDecimal, ParseBigDecimalError>

Creates and initializes a BigDecimal.

type FromStrRadixErr = ParseBigDecimalError

impl One for BigDecimal

pub fn one() -> BigDecimal

Returns the multiplicative identity element of Self, 1. Read more

fn set_one(&mut self)[src]

Sets self to the multiplicative identity element of Self, 1.

fn is_one(&self) -> bool where
    Self: PartialEq<Self>, 
[src]

Returns true if self is equal to the multiplicative identity. Read more

impl Ord for BigDecimal

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);

#[must_use]
fn max(self, other: Self) -> Self
1.21.0[src]

Compares and returns the maximum of two values. Read more

#[must_use]
fn min(self, other: Self) -> Self
1.21.0[src]

Compares and returns the minimum of two values. Read more

#[must_use]
fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]

Restrict a value to a certain interval. Read more

impl PartialEq<BigDecimal> for BigDecimal

pub fn eq(&self, rhs: &BigDecimal) -> bool

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

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl PartialOrd<BigDecimal> for BigDecimal

pub fn partial_cmp(&self, other: &BigDecimal) -> Option<Ordering>

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

#[must_use]
fn lt(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn le(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn gt(&self, other: &Rhs) -> bool
1.0.0[src]

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

#[must_use]
fn ge(&self, other: &Rhs) -> bool
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<'a> Rem<&'a BigDecimal> for BigDecimal

type Output = BigDecimal

The resulting type after applying the % operator.

pub fn rem(self, other: &BigDecimal) -> BigDecimal

Performs the % operation. Read more

impl<'a, 'b> Rem<&'b BigDecimal> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the % operator.

pub fn rem(self, other: &BigDecimal) -> BigDecimal

Performs the % operation. Read more

impl<'a> Rem<BigDecimal> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the % operator.

pub fn rem(self, other: BigDecimal) -> BigDecimal

Performs the % operation. Read more

impl Rem<BigDecimal> for BigDecimal

type Output = BigDecimal

The resulting type after applying the % operator.

pub fn rem(self, other: BigDecimal) -> BigDecimal

Performs the % operation. Read more

impl Signed for BigDecimal

pub fn abs(&self) -> BigDecimal

Computes the absolute value. Read more

pub fn abs_sub(&self, other: &BigDecimal) -> BigDecimal

The positive difference of two numbers. Read more

pub fn signum(&self) -> BigDecimal

Returns the sign of the number. Read more

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

Returns true if the number is negative and false if the number is zero or positive.

impl<'a> Sub<&'a BigDecimal> for BigDecimal

type Output = BigDecimal

The resulting type after applying the - operator.

pub fn sub(self, rhs: &BigDecimal) -> BigDecimal

Performs the - operation. Read more

impl<'a, 'b> Sub<&'a BigInt> for &'b BigDecimal

type Output = BigDecimal

The resulting type after applying the - operator.

pub fn sub(self, rhs: &BigInt) -> BigDecimal

Performs the - operation. Read more

impl<'a> Sub<&'a BigInt> for BigDecimal

type Output = BigDecimal

The resulting type after applying the - operator.

pub fn sub(self, rhs: &BigInt) -> BigDecimal

Performs the - operation. Read more

impl<'a, 'b> Sub<&'b BigDecimal> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the - operator.

pub fn sub(self, rhs: &BigDecimal) -> BigDecimal

Performs the - operation. Read more

impl Sub<BigDecimal> for BigDecimal

type Output = BigDecimal

The resulting type after applying the - operator.

pub fn sub(self, rhs: BigDecimal) -> BigDecimal

Performs the - operation. Read more

impl<'a> Sub<BigDecimal> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the - operator.

pub fn sub(self, rhs: BigDecimal) -> BigDecimal

Performs the - operation. Read more

impl Sub<BigInt> for BigDecimal

type Output = BigDecimal

The resulting type after applying the - operator.

pub fn sub(self, rhs: BigInt) -> BigDecimal

Performs the - operation. Read more

impl<'a> Sub<BigInt> for &'a BigDecimal

type Output = BigDecimal

The resulting type after applying the - operator.

pub fn sub(self, rhs: BigInt) -> BigDecimal

Performs the - operation. Read more

impl<'a> SubAssign<&'a BigDecimal> for BigDecimal

pub fn sub_assign(&mut self, rhs: &BigDecimal)

Performs the -= operation. Read more

impl<'a> SubAssign<&'a BigInt> for BigDecimal

pub fn sub_assign(&mut self, rhs: &BigInt)

Performs the -= operation. Read more

impl SubAssign<BigDecimal> for BigDecimal

pub fn sub_assign(&mut self, other: BigDecimal)

Performs the -= operation. Read more

impl<'a> SubAssign<BigInt> for BigDecimal

pub fn sub_assign(&mut self, rhs: BigInt)

Performs the -= operation. Read more

impl<'a> Sum<&'a BigDecimal> for 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

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

pub fn to_bigint(&self) -> Option<BigInt>

Converts the value of self to a BigInt.

impl ToPrimitive for BigDecimal

pub fn to_i64(&self) -> Option<i64>

Converts the value of self to an i64. If the value cannot be represented by an i64, then None is returned. Read more

pub fn to_u64(&self) -> Option<u64>

Converts the value of self to a u64. If the value cannot be represented by a u64, then None is returned. Read more

pub fn to_f64(&self) -> Option<f64>

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

fn to_isize(&self) -> Option<isize>[src]

Converts the value of self to an isize. If the value cannot be represented by an isize, then None is returned. Read more

fn to_i8(&self) -> Option<i8>[src]

Converts the value of self to an i8. If the value cannot be represented by an i8, then None is returned. Read more

fn to_i16(&self) -> Option<i16>[src]

Converts the value of self to an i16. If the value cannot be represented by an i16, then None is returned. Read more

fn to_i32(&self) -> Option<i32>[src]

Converts the value of self to an i32. If the value cannot be represented by an i32, then None is returned. Read more

fn to_i128(&self) -> Option<i128>[src]

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

fn to_usize(&self) -> Option<usize>[src]

Converts the value of self to a usize. If the value cannot be represented by a usize, then None is returned. Read more

fn to_u8(&self) -> Option<u8>[src]

Converts the value of self to a u8. If the value cannot be represented by a u8, then None is returned. Read more

fn to_u16(&self) -> Option<u16>[src]

Converts the value of self to a u16. If the value cannot be represented by a u16, then None is returned. Read more

fn to_u32(&self) -> Option<u32>[src]

Converts the value of self to a u32. If the value cannot be represented by a u32, then None is returned. Read more

fn to_u128(&self) -> Option<u128>[src]

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

fn to_f32(&self) -> Option<f32>[src]

Converts the value of self to an f32. Overflows may map to positive or negative inifinity, otherwise None is returned if the value cannot be represented by an f32. Read more

impl TryFrom<PgNumeric> for BigDecimal[src]

type Error = Box<dyn Error + 'static + Sync + Send, Global>

The type returned in the event of a conversion error.

pub fn try_from(
    numeric: PgNumeric
) -> Result<BigDecimal, Box<dyn Error + 'static + Sync + Send, Global>>
[src]

Performs the conversion.

impl TryFrom<f32> for BigDecimal

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>

Performs the conversion.

impl TryFrom<f64> for BigDecimal

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>

Performs the conversion.

impl Type<MySql> for BigDecimal[src]

pub fn type_info() -> MySqlTypeInfo[src]

Returns the canonical SQL type for this Rust type. Read more

fn compatible(ty: &<DB as Database>::TypeInfo) -> bool[src]

Determines if this Rust type is compatible with the given SQL type. Read more

impl Type<Postgres> for BigDecimal[src]

pub fn type_info() -> PgTypeInfo[src]

Returns the canonical SQL type for this Rust type. Read more

fn compatible(ty: &<DB as Database>::TypeInfo) -> bool[src]

Determines if this Rust type is compatible with the given SQL type. Read more

impl Zero for BigDecimal

pub fn zero() -> BigDecimal

Returns the additive identity element of Self, 0. Read more

pub fn is_zero(&self) -> bool

Returns true if self is equal to the additive identity.

fn set_zero(&mut self)[src]

Sets self to the additive identity element of Self, 0.

impl Eq for BigDecimal

impl StructuralEq for BigDecimal

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> CallHasher for T where
    T: Hash + ?Sized

pub default fn get_hash<H, B>(value: &H, build_hasher: &B) -> u64 where
    B: BuildHasher,
    H: Hash + ?Sized

impl<T> Conv for T

fn conv<T>(self) -> T where
    Self: Into<T>, 

Converts self into T using Into<T>. Read more

impl<T> Conv for T

fn conv<T>(self) -> T where
    Self: Into<T>, 

Converts self into a target type. Read more

impl<Q, K> Equivalent<K> for Q where
    K: Borrow<Q> + ?Sized,
    Q: Eq + ?Sized
[src]

pub fn equivalent(&self, key: &K) -> bool[src]

Compare self to key and return true if they are equal.

impl<T> FmtForward for T

fn fmt_binary(self) -> FmtBinary<Self> where
    Self: Binary

Causes self to use its Binary implementation when Debug-formatted.

fn fmt_display(self) -> FmtDisplay<Self> where
    Self: Display

Causes self to use its Display implementation when Debug-formatted. Read more

fn fmt_lower_exp(self) -> FmtLowerExp<Self> where
    Self: LowerExp

Causes self to use its LowerExp implementation when Debug-formatted. Read more

fn fmt_lower_hex(self) -> FmtLowerHex<Self> where
    Self: LowerHex

Causes self to use its LowerHex implementation when Debug-formatted. Read more

fn fmt_octal(self) -> FmtOctal<Self> where
    Self: Octal

Causes self to use its Octal implementation when Debug-formatted.

fn fmt_pointer(self) -> FmtPointer<Self> where
    Self: Pointer

Causes self to use its Pointer implementation when Debug-formatted. Read more

fn fmt_upper_exp(self) -> FmtUpperExp<Self> where
    Self: UpperExp

Causes self to use its UpperExp implementation when Debug-formatted. Read more

fn fmt_upper_hex(self) -> FmtUpperHex<Self> where
    Self: UpperHex

Causes self to use its UpperHex implementation when Debug-formatted. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<I> FromRadix10 for I where
    I: Zero + One + AddAssign<I> + MulAssign<I>, 

pub fn from_radix_10(text: &[u8]) -> (I, usize)

Parses an integer from a slice. Read more

impl<I> FromRadix10Signed for I where
    I: Zero + One + AddAssign<I> + SubAssign<I> + MulAssign<I>, 

pub fn from_radix_10_signed(text: &[u8]) -> (I, usize)

Parses an integer from a slice. Read more

impl<I> FromRadix16 for I where
    I: Zero + One + AddAssign<I> + MulAssign<I>, 

pub fn from_radix_16(text: &[u8]) -> (I, usize)

Parses an integer from a slice. Read more

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Pipe for T where
    T: ?Sized

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R

Pipes by value. This is generally the method you want to use. Read more

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
    R: 'a, 

Borrows self and passes that borrow into the pipe function. Read more

fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
    R: 'a, 

Mutably borrows self and passes that borrow into the pipe function. Read more

fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R where
    Self: Borrow<B>,
    R: 'a,
    B: 'a + ?Sized

Borrows self, then passes self.borrow() into the pipe function. Read more

fn pipe_borrow_mut<'a, B, R>(
    &'a mut self,
    func: impl FnOnce(&'a mut B) -> R
) -> R where
    Self: BorrowMut<B>,
    R: 'a,
    B: 'a + ?Sized

Mutably borrows self, then passes self.borrow_mut() into the pipe function. Read more

fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R where
    Self: AsRef<U>,
    U: 'a + ?Sized,
    R: 'a, 

Borrows self, then passes self.as_ref() into the pipe function.

fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R where
    Self: AsMut<U>,
    U: 'a + ?Sized,
    R: 'a, 

Mutably borrows self, then passes self.as_mut() into the pipe function. Read more

fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
    Self: Deref<Target = T>,
    T: 'a + ?Sized,
    R: 'a, 

Borrows self, then passes self.deref() into the pipe function.

fn pipe_deref_mut<'a, T, R>(
    &'a mut self,
    func: impl FnOnce(&'a mut T) -> R
) -> R where
    Self: DerefMut<Target = T> + Deref,
    T: 'a + ?Sized,
    R: 'a, 

Mutably borrows self, then passes self.deref_mut() into the pipe function. Read more

impl<T> Pipe for T

fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> R

Pipes a value into a function that cannot ordinarily be called in suffix position. Read more

impl<T> PipeAsRef for T

fn pipe_as_ref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
    Self: AsRef<T>,
    T: 'a,
    R: 'a, 

Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more

fn pipe_as_mut<'a, T, R>(&'a mut self, func: impl FnOnce(&'a mut T) -> R) -> R where
    Self: AsMut<T>,
    T: 'a,
    R: 'a, 

Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more

impl<T> PipeBorrow for T

fn pipe_borrow<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R where
    Self: Borrow<T>,
    T: 'a,
    R: 'a, 

Pipes a trait borrow into a function that cannot normally be called in suffix position. Read more

fn pipe_borrow_mut<'a, T, R>(
    &'a mut self,
    func: impl FnOnce(&'a mut T) -> R
) -> R where
    Self: BorrowMut<T>,
    T: 'a,
    R: 'a, 

Pipes a trait mutable borrow into a function that cannot normally be called in suffix position. Read more

impl<T> PipeDeref for T

fn pipe_deref<'a, R>(&'a self, func: impl FnOnce(&'a Self::Target) -> R) -> R where
    Self: Deref,
    R: 'a, 

Pipes a dereference into a function that cannot normally be called in suffix position. Read more

fn pipe_deref_mut<'a, R>(
    &'a mut self,
    func: impl FnOnce(&'a mut Self::Target) -> R
) -> R where
    Self: DerefMut,
    R: 'a, 

Pipes a mutable dereference into a function that cannot normally be called in suffix position. Read more

impl<T> PipeRef for T

fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> R where
    R: 'a, 

Pipes a reference into a function that cannot ordinarily be called in suffix position. Read more

fn pipe_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> R where
    R: 'a, 

Pipes a mutable reference into a function that cannot ordinarily be called in suffix position. Read more

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

fn tap(self, func: impl FnOnce(&Self)) -> Self

Immutable access to a value. Read more

fn tap_mut(self, func: impl FnOnce(&mut Self)) -> Self

Mutable access to a value. Read more

fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self where
    Self: Borrow<B>,
    B: ?Sized

Immutable access to the Borrow<B> of a value. Read more

fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self where
    Self: BorrowMut<B>,
    B: ?Sized

Mutable access to the BorrowMut<B> of a value. Read more

fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self where
    Self: AsRef<R>,
    R: ?Sized

Immutable access to the AsRef<R> view of a value. Read more

fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self where
    Self: AsMut<R>,
    R: ?Sized

Mutable access to the AsMut<R> view of a value. Read more

fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self where
    Self: Deref<Target = T>,
    T: ?Sized

Immutable access to the Deref::Target of a value. Read more

fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self where
    Self: DerefMut<Target = T> + Deref,
    T: ?Sized

Mutable access to the Deref::Target of a value. Read more

fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self

Calls .tap() only in debug builds, and is erased in release builds.

fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self

Calls .tap_mut() only in debug builds, and is erased in release builds. Read more

fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self where
    Self: Borrow<B>,
    B: ?Sized

Calls .tap_borrow() only in debug builds, and is erased in release builds. Read more

fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self where
    Self: BorrowMut<B>,
    B: ?Sized

Calls .tap_borrow_mut() only in debug builds, and is erased in release builds. Read more

fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self where
    Self: AsRef<R>,
    R: ?Sized

Calls .tap_ref() only in debug builds, and is erased in release builds. Read more

fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self where
    Self: AsMut<R>,
    R: ?Sized

Calls .tap_ref_mut() only in debug builds, and is erased in release builds. Read more

fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self where
    Self: Deref<Target = T>,
    T: ?Sized

Calls .tap_deref() only in debug builds, and is erased in release builds. Read more

fn tap_deref_mut_dbg<T>(self, func: impl FnOnce(&mut T)) -> Self where
    Self: DerefMut<Target = T> + Deref,
    T: ?Sized

Calls .tap_deref_mut() only in debug builds, and is erased in release builds. Read more

impl<T> Tap for T

fn tap<F, R>(self, func: F) -> Self where
    F: FnOnce(&Self) -> R, 

Provides immutable access for inspection. Read more

fn tap_dbg<F, R>(self, func: F) -> Self where
    F: FnOnce(&Self) -> R, 

Calls tap in debug builds, and does nothing in release builds.

fn tap_mut<F, R>(self, func: F) -> Self where
    F: FnOnce(&mut Self) -> R, 

Provides mutable access for modification. Read more

fn tap_mut_dbg<F, R>(self, func: F) -> Self where
    F: FnOnce(&mut Self) -> R, 

Calls tap_mut in debug builds, and does nothing in release builds.

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

fn tap_ref<F, R>(self, func: F) -> Self where
    Self: AsRef<T>,
    F: FnOnce(&T) -> R, 

Provides immutable access to the reference for inspection.

fn tap_ref_dbg<F, R>(self, func: F) -> Self where
    Self: AsRef<T>,
    F: FnOnce(&T) -> R, 

Calls tap_ref in debug builds, and does nothing in release builds.

fn tap_ref_mut<F, R>(self, func: F) -> Self where
    Self: AsMut<T>,
    F: FnOnce(&mut T) -> R, 

Provides mutable access to the reference for modification.

fn tap_ref_mut_dbg<F, R>(self, func: F) -> Self where
    Self: AsMut<T>,
    F: FnOnce(&mut T) -> R, 

Calls tap_ref_mut in debug builds, and does nothing in release builds.

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

fn tap_borrow<F, R>(self, func: F) -> Self where
    Self: Borrow<T>,
    F: FnOnce(&T) -> R, 

Provides immutable access to the borrow for inspection. Read more

fn tap_borrow_dbg<F, R>(self, func: F) -> Self where
    Self: Borrow<T>,
    F: FnOnce(&T) -> R, 

Calls tap_borrow in debug builds, and does nothing in release builds.

fn tap_borrow_mut<F, R>(self, func: F) -> Self where
    Self: BorrowMut<T>,
    F: FnOnce(&mut T) -> R, 

Provides mutable access to the borrow for modification.

fn tap_borrow_mut_dbg<F, R>(self, func: F) -> Self where
    Self: BorrowMut<T>,
    F: FnOnce(&mut T) -> R, 

Calls tap_borrow_mut in debug builds, and does nothing in release builds. Read more

impl<T> TapDeref for T

fn tap_deref<F, R>(self, func: F) -> Self where
    Self: Deref,
    F: FnOnce(&Self::Target) -> R, 

Immutably dereferences self for inspection.

fn tap_deref_dbg<F, R>(self, func: F) -> Self where
    Self: Deref,
    F: FnOnce(&Self::Target) -> R, 

Calls tap_deref in debug builds, and does nothing in release builds.

fn tap_deref_mut<F, R>(self, func: F) -> Self where
    Self: DerefMut,
    F: FnOnce(&mut Self::Target) -> R, 

Mutably dereferences self for modification.

fn tap_deref_mut_dbg<F, R>(self, func: F) -> Self where
    Self: DerefMut,
    F: FnOnce(&mut Self::Target) -> R, 

Calls tap_deref_mut in debug builds, and does nothing in release builds. Read more

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T> TryConv for T

fn try_conv<T>(self) -> Result<T, Self::Error> where
    Self: TryInto<T>, 

Attempts to convert self into T using TryInto<T>. Read more

impl<T> TryConv for T

fn try_conv<T>(self) -> Result<T, Self::Error> where
    Self: TryInto<T>, 

Attempts to convert self into a target type. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V

impl<T, Rhs, Output> NumOps<Rhs, Output> for T where
    T: Sub<Rhs, Output = Output> + Mul<Rhs, Output = Output> + Div<Rhs, Output = Output> + Add<Rhs, Output = Output> + Rem<Rhs, Output = Output>, 
[src]

impl<T> NumRef for T where
    T: Num + for<'r> NumOps<&'r T, T>, 
[src]

impl<T, Base> RefNum<Base> for T where
    T: NumOps<Base, Base> + for<'r> NumOps<&'r Base, Base>, 
[src]