diff --git a/Cargo.lock b/Cargo.lock index fa2de72ea..acf3aba60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -50,6 +50,15 @@ dependencies = [ "memchr", ] +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anyhow" version = "1.0.100" @@ -546,7 +555,7 @@ dependencies = [ "getrandom 0.2.16", "getrandom 0.3.2", "hex", - "indexmap", + "indexmap 2.12.0", "js-sys", "once_cell", "rand", @@ -565,14 +574,17 @@ dependencies = [ "ahash", "base64", "bitvec", + "chrono", "getrandom 0.3.2", "hex", - "indexmap", + "indexmap 2.12.0", + "jiff", "js-sys", "rand", "serde", "serde_bytes", "serde_json", + "serde_with", "simdutf8", "thiserror", "time", @@ -649,7 +661,10 @@ version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" dependencies = [ + "iana-time-zone", "num-traits", + "serde", + "windows-link 0.2.1", ] [[package]] @@ -879,6 +894,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ececcb659e7ba858fb4f10388c250a7252eb0a27373f1a72b8748afdd248e587" dependencies = [ "powerfmt", + "serde_core", ] [[package]] @@ -967,6 +983,12 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + [[package]] name = "either" version = "1.15.0" @@ -1244,13 +1266,19 @@ dependencies = [ "futures-core", "futures-sink", "http 1.3.1", - "indexmap", + "indexmap 2.12.0", "slab", "tokio", "tokio-util", "tracing", ] +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + [[package]] name = "hashbrown" version = "0.16.0" @@ -1510,6 +1538,30 @@ dependencies = [ "windows-registry", ] +[[package]] +name = "iana-time-zone" +version = "0.1.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33e57f83510bb73707521ebaffa789ec8caf86f9657cad665b092b581d40e9fb" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + [[package]] name = "icu_collections" version = "2.1.1" @@ -1618,6 +1670,17 @@ dependencies = [ "icu_properties", ] +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + [[package]] name = "indexmap" version = "2.12.0" @@ -1625,7 +1688,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6717a8d2a5a929a1a2eb43a12812498ed141a0bcfb7e8f7844fbdbe4303bba9f" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.16.0", + "serde", + "serde_core", ] [[package]] @@ -1681,6 +1746,28 @@ version = "1.0.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" +[[package]] +name = "jiff" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be1f93b8b1eb69c77f24bbb0afdf66f54b632ee39af40ca21c4365a1d7347e49" +dependencies = [ + "jiff-static", + "portable-atomic", + "portable-atomic-util", +] + +[[package]] +name = "jiff-static" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03343451ff899767262ec32146f6d559dd759fdadf42ff0e227c7c48f72594b4" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + [[package]] name = "jobserver" version = "0.1.34" @@ -2337,6 +2424,15 @@ version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f84267b20a16ea918e43c6a88433c2d54fa145c92a811b5b047ccbe153674483" +[[package]] +name = "portable-atomic-util" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8a2f0d8d040d7848a709caf78912debcc3f33ee4b3cac47d73d1e1069e83507" +dependencies = [ + "portable-atomic", +] + [[package]] name = "potential_utf" version = "0.1.4" @@ -2539,6 +2635,26 @@ dependencies = [ "bitflags", ] +[[package]] +name = "ref-cast" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f354300ae66f76f1c85c5f84693f0ce81d747e2c3f21a45fef496d89c960bf7d" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7186006dcb21920990093f30e3dea63b7d6e977bf1256be20c3563a5db070da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + [[package]] name = "regex" version = "1.12.2" @@ -2762,6 +2878,30 @@ dependencies = [ "windows-sys 0.61.0", ] +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9558e172d4e8533736ba97870c4b2cd63f84b382a3d6eb063da41b91cce17289" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + [[package]] name = "scopeguard" version = "1.2.0" @@ -2878,7 +3018,7 @@ version = "1.0.145" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "402a6f66d8c709116cf22f558eab210f5a50187f702eb4d7e5ef38d9a7f1c79c" dependencies = [ - "indexmap", + "indexmap 2.12.0", "itoa", "memchr", "ryu", @@ -2915,8 +3055,17 @@ version = "3.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "aa66c845eee442168b2c8134fec70ac50dc20e760769c8ba0ad1319ca1959b04" dependencies = [ + "base64", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.12.0", + "schemars 0.9.0", + "schemars 1.1.0", "serde_core", + "serde_json", "serde_with_macros", + "time", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 564db1254..23b2a07be 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -67,6 +67,17 @@ in-use-encryption = ["dep:mongocrypt", "dep:rayon", "dep:num_cpus"] # The in-use encryption API is stable; this is for backwards compatibility. in-use-encryption-unstable = ["in-use-encryption"] +# Enables extra chrono interfaces for the bson crate. +bson3-chrono = ["bson3/chrono-0_4"] +# Enables extra jiff interfaces for the bson crate. +bson3-jiff = ["bson3/jiff-0_2"] +# Enables extra time interfaces for the bson crate. +# bson3-time = ["bson3/time"] +# Enables extra uuid interfaces for the bson crate. +bson3-uuid = ["bson3/uuid-1"] +# Enables extra serde-with interfaces for the bson crate (chrono/uuid) +bson3-serde-with = ["bson3/serde", "bson3/serde_with-3"] + # Enables support for emitting tracing events. # The tracing API is unstable and may have backwards-incompatible changes in minor version updates. # TODO: pending https://github.com/tokio-rs/tracing/issues/2036 stop depending directly on log. diff --git a/README.md b/README.md index af9f9e524..18e0b76a3 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,10 @@ features = ["sync"] | `text-indexes-unstable` | Enables support for text indexes in explicit encryption. This feature is in preview and should be used for experimental workloads only. This feature is unstable and its security is not guaranteed until released as Generally Available (GA). The GA version of this feature may not be backwards compatible with the preview version. | | `error-backtrace` | Capture backtraces in `Error` values. This can be slow, memory intensive, and very verbose. | | `bson-3` | Use version 3.x of the `bson` crate; for backwards compatibility, without this feature enabled `bson` 2.x is used. | +| `bson3-chrono` | Enable extra [`chrono`](https://docs.rs/chrono/latest/chrono/) APIs for `bson3` | +| `bson3-jiff` | Enable extra [`jiff`](https://docs.rs/jiff/latest/jiff/) APIs for `bson3` | +| `bson3-uuid` | Enable extra [`uuid`](https://docs.rs/uuid/latest/uuid/) APIs for `bson3` | +| `bson3-serde-with` | Enable extra [`serde-with`](https://docs.rs/serde_with/latest/serde_with/) helpers for `bson3` | ## Web Framework Examples