Struct bson::decimal128::Decimal128 [−][src]
pub struct Decimal128 { /* fields omitted */ }
Expand description
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
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");
Construct a Decimal128
from a i32
number.
use bson::decimal128::Decimal128; let num: i32 = 23; let dec128 = Decimal128::from_i32(num);
Construct a Decimal128
from a u32
number.
use bson::decimal128::Decimal128; let num: u32 = 78; let dec128 = Decimal128::from_u32(num);
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);
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);
Create a new Decimal128 as 0
.
use bson::decimal128::Decimal128; let dec128 = Decimal128::zero();
Check if value is NaN
use bson::decimal128::Decimal128; let num: u32 = 78; let dec128 = Decimal128::from_u32(num); assert!(!dec128.is_nan());
Trait Implementations
Returns the “default value” for a type. Read more
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
Performs the conversion.
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
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
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
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V