KiwiTalk / loco.rs

Loco Protocol Wrapper for Rust
Apache License 2.0
41 stars 5 forks source link

Update bson requirement from 1.0 to 2.0 #58

Closed dependabot[bot] closed 2 years ago

dependabot[bot] commented 2 years ago

Updates the requirements on bson to permit the latest version.

Release notes

Sourced from bson's releases.

v2.0.0

Description

The MongoDB Rust driver team is pleased to announce the v2.0.0 release of the bson crate. This release is the culmination of several months of work, and it contains a number of new features, API improvements, and bug fixes. This release will be included in v2.0.0 of the driver. It is intended that this release will be very stable and that bson will not have another major release for quite a long time.

Note that the new minimum supported Rust version (MSRV) is now 1.48.0.

Highlighted changes

The following sections detail some of the more important changes included in this release. For a full list of changes, see the Full Release Notes section below.

Ensure API meets the Rust API Guidelines (RUST-765)

There is a community maintained list of API guidelines that every stable Rust library is recommended to meet. The crate's existing API wasn't conforming to these guidelines exactly, so a number of improvements were made to ensure that it does. Here we highlight a few of the more important changes made in this effort.

Stabilize or eliminate public dependencies on unstable crates (C-STABLE, RUST-739)

bson included types from a number of unstable (pre-1.0) dependencies in its public API, which presented a problem for the stability of the library itself. In an effort to ensure that bson will no longer be subject to the semver breaks of unstable dependencies and can stay on 2.0 for the foreseeable future, the public dependencies on unstable types were removed altogether or gated behind feature flags.

Here are the notable changes made as part of that:

  • Bson::DateTime(chrono::DateTime<Utc>) => Bson::DateTime(bson::DateTime), struct Datetime(pub chrono::DateTime) => struct DateTime { /* private fields */ }
    • Instead of directly including a DateTime from chrono (which is currently 0.4) in the Bson enum, the variant now wraps the bson::DateTime newtype defined within bson, and that newtype also no longer wraps a chrono::DateTime. This way the dependency on chrono can be updated to new semver breaking versions without having to update bson's major version.
    • To ease in the construction and usage of the newtype from chrono::DateTime, the chrono-0_4 feature flag can be enabled, which includes a From<chrono::DateTime> implementation for bson::DateTime and a From<bson::DateTime> implementation for chrono::DateTime, as well as some serde helpers.
  • Document::get_datetime returns a ValueAccessResult of &bson::DateTime instead of &chrono::DateTime
  • Bson::as_datetime returns an Option of &bson::DateTime instead of &chrono::DateTime
  • ObjectId::timestamp returns a crate::DateTime instead of chrono::DateTime
  • oid::Error no longer wraps hex::FromHexError (the hex crate is 0.4), see below for details.
  • The Uuid serde helpers, as well as From<Uuid> implementations for Bson and Binary, are now gated behind the uuid-0_8 feature flag.

Accept impl AsRef<str> in Document methods (C-GENERIC, RUST-765)

The methods on Document that accepted keys previously accepted them as &str. They were updated to accept impl AsRef<str> instead to allow other string-like types to be used for key lookup, such as String.

Use more standard conversion constructors for ObjectId (C-CONV-TRAITS, C-CTOR, RUST-789)

ObjectId previously had three constructors: new, with_bytes, and with_string. The latter two were a bit inconsistent with the functions they performed and with similar constructors for related types in the Rust ecosystem. To remedy this, the constructors were updated to match uuid::Uuid's constructor API:

  • ObjectId::with_bytes => const ObjectId::from_bytes
  • ObjectId::with_string => ObjectId::parse_str

Error naming improvements (C-WORD-ORDER, C-STABLE)

Some error variants were renamed or restructured to be clearer or more informative. A complete summary of the changes are as follows:

  • bson::de::Error:
    • IoError => Io
    • FromUtf8Error => InvalidUtf8String
    • SyntaxError => removed, consolidated into DeserializationError.
    • InvalidTimestamp(i64) => InvalidDateTime { key: String, datetime: i64 }
  • bson::ser::Error:
    • IoError => Io
    • InvalidMapKeyType { key: Bson } => InvalidDocumentKey(Bson)
    • UnsupportedUnsignedType => removed

... (truncated)

Commits
  • fb18ed2 release v2.0.0
  • 0608c84 RUST-1009 Return false from is_human_readable in raw serializer (#298)
  • 01fea3f RUST-736 Update documentation for 2.0 release (#295)
  • 7910f07 RUST-730 Document MSRV policy
  • 9d79e45 RUST-968 Remove u2i feature flag (#296)
  • dbfa947 RUST-968 Enable u2i feature by default (#294)
  • d112672 RUST-996 Update to rand = "0.8" (#290)
  • 45aab7e release v2.0.0-beta.3
  • 342ab2b RUST-889 Deserialize ObjectId directly from bytes in raw deserializer (#289)
  • aeef692 RUST-960 Remove the decimal128 feature flag (#287)
  • Additional commits viewable in compare view


Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot merge` will merge this PR after your CI passes on it - `@dependabot squash and merge` will squash and merge this PR after your CI passes on it - `@dependabot cancel merge` will cancel a previously requested merge and block automerging - `@dependabot reopen` will reopen this PR if it is closed - `@dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)