File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,21 @@ use bitvec::prelude::*;
6
6
7
7
/// Struct representing a BSON Decimal128 type.
8
8
///
9
- /// Currently, this type can only be used to round-trip through BSON. See
10
- /// [RUST-36](https://jira.mongodb.org/browse/RUST-36) to track the progress towards a complete implementation.
9
+ /// This type supports conversion to and from human-readable strings via the [std::fmt::Display] and
10
+ /// [std::str::FromStr] traits:
11
+ ///
12
+ /// ```rust
13
+ /// # use std::str::FromStr;
14
+ /// # use bson::Decimal128;
15
+ /// # fn example() -> std::result::Result<(), Box<dyn std::error::Error>> {
16
+ /// let value: Decimal128 = "3.14159".parse()?;
17
+ /// assert_eq!("3.14159", format!("{}", value));
18
+ /// let scientific = Decimal128::from_str("1.05E+3")?;
19
+ /// assert_eq!("1.05E+3", scientific.to_string());
20
+ /// # Ok(())
21
+ /// # }
22
+ /// # example().unwrap()
23
+ /// ```
11
24
#[ derive( Copy , Clone , PartialEq ) ]
12
25
pub struct Decimal128 {
13
26
/// BSON bytes containing the decimal128. Stored for round tripping.
You can’t perform that action at this time.
0 commit comments