[][src]Struct bson::decimal128::Decimal128

pub struct Decimal128 { /* fields omitted */ }

Decimal128 type.

Currently, this type does not have any functionality and can only be serialized and deserialized from existing documents that contain BSON decimal128s.

Experimental functionality can be enabled through the usage of the "decimal128" feature flag. Note that the API and behavior of such functionality are unstable and subject to change.

Implementations

impl Decimal128[src]

pub fn from_str(s: &str) -> Decimal128[src]

Construct a Decimal128 from string.

For example:

  • NaN
  • Infinity or Inf
  • 1.0, +37.0, 0.73e-7, .5
use bson::decimal128::Decimal128;

let dec128 = Decimal128::from_str("1.05E+3");

pub fn from_i32(d: i32) -> Decimal128[src]

Construct a Decimal128 from a i32 number.

use bson::decimal128::Decimal128;

let num: i32 = 23;
let dec128 = Decimal128::from_i32(num);

pub fn from_u32(d: u32) -> Decimal128[src]

Construct a Decimal128 from a u32 number.

use bson::decimal128::Decimal128;

let num: u32 = 78;
let dec128 = Decimal128::from_u32(num);

pub fn into_i32(&self) -> i32[src]

👎 Deprecated since 0.15.0:

Replaced by to_i32

Construct a Decimal128 from a i32 number.

use bson::decimal128::Decimal128;

let num: i32 = 23;
let dec128 = Decimal128::from_i32(num);
let int = dec128.into_i32();
assert_eq!(int, num);

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

Construct a Decimal128 from a i32 number.

use bson::decimal128::Decimal128;

let num: i32 = 23;
let dec128 = Decimal128::from_i32(num);
let int = dec128.to_i32();
assert_eq!(int, num);

pub fn into_u32(&self) -> u32[src]

👎 Deprecated since 0.15.0:

Replaced by to_u32

Construct a Decimal128 from a i32 number.

use bson::decimal128::Decimal128;

let num: u32 = 23;
let dec128 = Decimal128::from_u32(num);
let int = dec128.into_u32();
assert_eq!(int, num);

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

Construct a Decimal128 from a i32 number.

use bson::decimal128::Decimal128;

let num: u32 = 23;
let dec128 = Decimal128::from_u32(num);
let int = dec128.to_u32();
assert_eq!(int, num);

pub fn zero() -> Decimal128[src]

Create a new Decimal128 as 0.

use bson::decimal128::Decimal128;

let dec128 = Decimal128::zero();

pub fn is_nan(&self) -> bool[src]

Check if value is NaN

use bson::decimal128::Decimal128;

let num: u32 = 78;
let dec128 = Decimal128::from_u32(num);
assert!(!dec128.is_nan());

pub fn is_zero(&self) -> bool[src]

Check if value is 0

use bson::decimal128::Decimal128;

let num: u32 = 0;
let dec128 = Decimal128::from_u32(num);
assert!(dec128.is_zero());

Trait Implementations

impl Clone for Decimal128[src]

impl Debug for Decimal128[src]

impl Default for Decimal128[src]

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

impl Display for Decimal128[src]

impl From<d128> for Decimal128[src]

impl FromStr for Decimal128[src]

type Err = ()

The associated error which can be returned from parsing.

impl Into<d128> for Decimal128[src]

impl LowerExp for Decimal128[src]

impl LowerHex for Decimal128[src]

impl PartialEq<Decimal128> for Decimal128[src]

impl PartialOrd<Decimal128> for Decimal128[src]

impl Serialize for Decimal128[src]

impl StructuralPartialEq for Decimal128[src]

Auto Trait Implementations

Blanket Implementations

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

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

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

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

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

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

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

type Owned = T

The resulting type after obtaining ownership.

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

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.

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.

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