@@ -10,8 +10,12 @@ use std::fmt;
1010/// deserialized from existing documents that contain BSON decimal128s.
1111///
1212/// Experimental functionality can be enabled through the usage of the `"decimal128"`
13- /// feature flag. Note that the API and behavior of such functionality are unstable and
14- /// subject to change.
13+ /// feature flag. The flag is not recommended for use however, as it causes `Decimal128` values to
14+ /// serialize to BSON incorrectly. See [this issue](https://github.com/mongodb/bson-rust/issues/282#issuecomment-889958970) for
15+ /// more information.
16+ ///
17+ /// Note that the API and behavior of the feature-gated functionality are unstable and subject to
18+ /// change, and the feature flag will be removed completely in 2.0.0.
1519#[ derive( Clone , PartialEq , PartialOrd ) ]
1620pub struct Decimal128 {
1721 #[ cfg( not( feature = "decimal128" ) ) ]
@@ -23,6 +27,8 @@ pub struct Decimal128 {
2327}
2428
2529#[ cfg( feature = "decimal128" ) ]
30+ #[ deprecated = "The feature-gated decimal128 implementation serializes to BSON incorrectly and \
31+ should not be used. It will be removed completely in 2.0.0"]
2632impl Decimal128 {
2733 /// Construct a `Decimal128` from string.
2834 ///
@@ -231,6 +237,7 @@ impl fmt::LowerExp for Decimal128 {
231237}
232238
233239#[ cfg( feature = "decimal128" ) ]
240+ #[ allow( deprecated) ]
234241impl std:: str:: FromStr for Decimal128 {
235242 type Err = ( ) ;
236243 fn from_str ( s : & str ) -> Result < Decimal128 , ( ) > {
@@ -253,6 +260,7 @@ impl From<d128> for Decimal128 {
253260}
254261
255262#[ cfg( feature = "decimal128" ) ]
263+ #[ allow( deprecated) ]
256264impl Default for Decimal128 {
257265 fn default ( ) -> Decimal128 {
258266 Decimal128 :: zero ( )
@@ -261,6 +269,7 @@ impl Default for Decimal128 {
261269
262270#[ cfg( test) ]
263271#[ cfg( feature = "decimal128" ) ]
272+ #[ allow( deprecated) ]
264273mod test {
265274 use super :: * ;
266275
0 commit comments