[−][src]Struct bson::decimal128::Decimal128
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
orInf
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]
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]
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]
fn clone(&self) -> Decimal128
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Decimal128
[src]
impl Default for Decimal128
[src]
fn default() -> Decimal128
[src]
impl<'de> Deserialize<'de> for Decimal128
[src]
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
[src]
D: Deserializer<'de>,
impl Display for Decimal128
[src]
impl From<d128> for Decimal128
[src]
fn from(d: d128) -> Decimal128
[src]
impl FromStr for Decimal128
[src]
type Err = ()
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Decimal128, ()>
[src]
impl Into<d128> for Decimal128
[src]
impl LowerExp for Decimal128
[src]
impl LowerHex for Decimal128
[src]
impl PartialEq<Decimal128> for Decimal128
[src]
fn eq(&self, other: &Decimal128) -> bool
[src]
fn ne(&self, other: &Decimal128) -> bool
[src]
impl PartialOrd<Decimal128> for Decimal128
[src]
fn partial_cmp(&self, other: &Decimal128) -> Option<Ordering>
[src]
fn lt(&self, other: &Decimal128) -> bool
[src]
fn le(&self, other: &Decimal128) -> bool
[src]
fn gt(&self, other: &Decimal128) -> bool
[src]
fn ge(&self, other: &Decimal128) -> bool
[src]
impl Serialize for Decimal128
[src]
impl StructuralPartialEq for Decimal128
[src]
Auto Trait Implementations
impl RefUnwindSafe for Decimal128
impl Send for Decimal128
impl Sync for Decimal128
impl Unpin for Decimal128
impl UnwindSafe for Decimal128
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,