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

Standardize on ObjectId conversion constructors

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • bson-2.0.0-beta
    • Affects Version/s: None
    • Component/s: BSON
    • 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@mongodb.com Patrick Freed
            Reporter:
            patrick.freed@mongodb.com Patrick Freed
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: