-
Type: Improvement
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: BSON
-
None
The BSON library currently offers free-floating public encode_document and decode_document functions for converting Document to/from bytes. These were defined as free floating in an attempt to match how serde_json defines its methods, but those were defined as such because they're generic over the type being encoded/decoded. encode_document and decode_document operate specifically with Document, so they would make more sense as methods in the Document namespace, e.g. Document::decode and document.encode().
Additionally, if RUST-428 is implemented, these free-floating functions will become redundant if left as-is. As methods on Document, they will simply become nice conveniences.
As this would be a breaking change, it must be done pre 1.0.