Uploaded image for project: 'Rust Driver'
  1. Rust Driver
  2. RUST-429

Move encode_document and decode_document into the Document namespace

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • bson-0.15.0
    • Affects Version/s: None
    • Component/s: BSON
    • Labels:
      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.

            Assignee:
            isabel.atkinson@mongodb.com Isabel Atkinson
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: