Standardize on ObjectId conversion constructors

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Fixed
    • Priority: Unknown
    • bson-2.0.0-beta
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      ObjectId currently has three constructors: new, with_bytes, and with_string. The latter use somewhat nonstandard naming for what they do:

      • with_bytes is a conversion, so it should probably be from_bytes and/or have a From<_> impl.
      • with_string accepts an &str, so it should indicate that. Also, given that it is failable, it could imply that via a prefix like parse instead of with

       To remedy this, we should follow uuid::Uuid's API and update the various constructors to be more standard. This is in line with the C-CONV-TRAITS and C-CTOR Rust API guidelines.

              Assignee:
              Patrick Freed
              Reporter:
              Patrick Freed
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: