Skip to content

Commit d75355f

Browse files
release 1.2.0 (#290)
1 parent 3639656 commit d75355f

File tree

15 files changed

+69
-18
lines changed

15 files changed

+69
-18
lines changed

.evergreen/check-rustdoc.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#!/bin/sh
2+
3+
set -o errexit
4+
5+
. ~/.cargo/env
6+
cargo rustdoc -- -D warnings
7+
cargo rustdoc --no-default-features --features async-std-runtime -- -D warnings
8+
cargo rustdoc --no-default-features --features sync -- -D warnings

.evergreen/config.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -497,6 +497,16 @@ functions:
497497
${PREPARE_SHELL}
498498
.evergreen/check-clippy.sh
499499
500+
"check rustdoc":
501+
- command: shell.exec
502+
type: test
503+
params:
504+
shell: bash
505+
working_dir: "src"
506+
script: |
507+
${PREPARE_SHELL}
508+
.evergreen/check-rustdoc.sh
509+
500510
"upload-mo-artifacts":
501511
- command: shell.exec
502512
params:
@@ -1115,6 +1125,10 @@ tasks:
11151125
commands:
11161126
- func: "check clippy"
11171127

1128+
- name: "check-rustdoc"
1129+
commands:
1130+
- func: "check rustdoc"
1131+
11181132

11191133

11201134
axes:
@@ -1342,4 +1356,5 @@ buildvariants:
13421356
tasks:
13431357
- name: "check-clippy"
13441358
- name: "check-rustfmt"
1359+
- name: "check-rustdoc"
13451360

Cargo.toml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
authors = ["Saghm Rossi <[email protected]>", "Patrick Freed <[email protected]>"]
2+
authors = ["Saghm Rossi <[email protected]>", "Patrick Freed <[email protected]>", "Isabel Atkinson <[email protected]>"]
33
description = "The official MongoDB driver for Rust"
44
edition = "2018"
55
documentation = "https://docs.rs/mongodb"
@@ -8,7 +8,7 @@ repository = "https://github.com/mongodb/mongo-rust-driver"
88
license = "Apache-2.0"
99
readme = "README.md"
1010
name = "mongodb"
11-
version = "1.1.1"
11+
version = "1.2.0"
1212

1313
exclude = [
1414
"etc/**",
@@ -24,12 +24,17 @@ default = ["tokio-runtime"]
2424
tokio-runtime = ["tokio/dns", "tokio/macros", "tokio/rt-core", "tokio/tcp", "tokio/rt-threaded", "tokio/time", "reqwest", "serde_bytes"]
2525
async-std-runtime = ["async-std", "async-std/attributes"]
2626
sync = ["async-std-runtime"]
27+
# The bson/u2i feature enables automatic conversion from unsigned to signed types during
28+
# serialization. This feature is intended for use when serializing data types in third-party crates
29+
# whose implementation cannot be changed; otherwise, it is preferred to use the helper functions
30+
# provided in the bson::serde_helpers module.
31+
bson-u2i = ["bson/u2i"]
2732

2833
[dependencies]
2934
async-trait = "0.1.24"
3035
base64 = "0.11.0"
3136
bitflags = "1.1.0"
32-
bson = "1.1.0"
37+
bson = "1.2.0"
3338
chrono = "0.4.7"
3439
derivative = "2.1.1"
3540
err-derive = "0.2.3"

README.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ This repository contains the officially supported MongoDB Rust driver, a client
2929
| Driver Version | Required Rust Version |
3030
|:--------------:|:---------------------:|
3131
| master | 1.43+ |
32+
| 1.2.x | 1.43+ |
3233
| 1.1.x | 1.43+ |
3334
| 1.0.x | 1.43+ |
3435
| 0.11.x | 1.43+ |
@@ -45,7 +46,7 @@ https://github.com/rust-lang/rust/issues/75992.
4546
The driver is available on [crates.io](https://crates.io/crates/mongodb). To use the driver in your application, simply add it to your project's `Cargo.toml`.
4647
```toml
4748
[dependencies]
48-
mongodb = "1.1.1"
49+
mongodb = "1.2.0"
4950
```
5051

5152
#### Configuring the async runtime
@@ -54,7 +55,7 @@ The driver supports both of the most popular async runtime crates, namely [`toki
5455
For example, to instruct the driver to work with [`async-std`](https://crates.io/crates/async-std), add the following to your `Cargo.toml`:
5556
```toml
5657
[dependencies.mongodb]
57-
version = "1.1.1"
58+
version = "1.2.0"
5859
default-features = false
5960
features = ["async-std-runtime"]
6061
```
@@ -63,7 +64,7 @@ features = ["async-std-runtime"]
6364
The driver also provides a blocking sync API. To enable this, add the `"sync"` feature to your `Cargo.toml`:
6465
```toml
6566
[dependencies.mongodb]
66-
version = "1.1.1"
67+
version = "1.2.0"
6768
default-features = false
6869
features = ["sync"]
6970
```
@@ -270,9 +271,11 @@ You can use `rustup` to install them both:
270271
rustup component add clippy --toolchain stable
271272
rustup component add rustfmt --toolchain nightly
272273
```
273-
To run the linter tests, run the `check-clippy.sh` and `check-rustfmt.sh` scripts in the `.evergreen` directory:
274+
Our linter tests also use `rustdoc` to verify that all necessary documentation is present and properly formatted. `rustdoc` is included in the standard Rust distribution.
275+
276+
To run the linter tests, run the `check-clippy.sh`, `check-rustfmt.sh`, and `check-rustdoc.sh` scripts in the `.evergreen` directory:
274277
```bash
275-
bash .evergreen/check-clippy.sh && bash .evergreen/check-rustfmt.sh
278+
bash .evergreen/check-clippy.sh && bash .evergreen/check-rustfmt.sh && bash .evergreen/check-rustdoc.sh
276279
```
277280

278281
## Continuous Integration

src/client/auth/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,7 @@ impl AuthMechanism {
181181
}
182182
}
183183

184+
/// Returns this `AuthMechanism` as a string.
184185
pub fn as_str(&self) -> &'static str {
185186
match self {
186187
AuthMechanism::ScramSha1 => SCRAM_SHA_1_STR,

src/client/options/mod.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ impl Hash for StreamAddress {
142142
}
143143

144144
impl StreamAddress {
145+
/// Parses an address string into a `StreamAddress`.
145146
pub fn parse(address: &str) -> Result<Self> {
146147
let mut parts = address.split(':');
147148

@@ -209,7 +210,7 @@ impl fmt::Display for StreamAddress {
209210
/// Specifies the server API version to declare
210211
#[derive(Clone, Debug, PartialEq)]
211212
#[non_exhaustive]
212-
pub enum ServerApiVersion {
213+
pub(crate) enum ServerApiVersion {
213214
Version1,
214215
}
215216

@@ -251,7 +252,7 @@ impl<'de> Deserialize<'de> for ServerApiVersion {
251252
#[derive(Clone, Debug, Deserialize, PartialEq, TypedBuilder)]
252253
#[serde(rename_all = "camelCase")]
253254
#[non_exhaustive]
254-
pub struct ServerApi {
255+
pub(crate) struct ServerApi {
255256
/// The version string of the declared API version
256257
pub version: ServerApiVersion,
257258

@@ -402,8 +403,8 @@ pub struct ClientOptions {
402403
/// The declared API version
403404
///
404405
/// The default value is to have no declared API version
405-
#[builder(default)]
406-
pub server_api: Option<ServerApi>,
406+
#[builder(default, skip)]
407+
pub(crate) server_api: Option<ServerApi>,
407408

408409
/// The amount of time the Client should attempt to select a server for an operation before
409410
/// timing outs
@@ -509,7 +510,10 @@ struct ClientOptionsParser {
509510
/// [`Client`](../struct.Client.html) performs.
510511
#[derive(Clone, Debug, Deserialize, PartialEq)]
511512
pub enum Tls {
513+
/// Enable TLS with the specified options.
512514
Enabled(TlsOptions),
515+
516+
/// Disable TLS.
513517
Disabled,
514518
}
515519

@@ -566,6 +570,7 @@ impl ServerCertVerifier for NoCertVerifier {
566570
}
567571

568572
impl TlsOptions {
573+
/// Converts `TlsOptions` into a rustls::ClientConfig.
569574
pub fn into_rustls_config(self) -> Result<rustls::ClientConfig> {
570575
let mut config = rustls::ClientConfig::new();
571576

src/cmap/options.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ pub struct ConnectionPoolOptions {
8585
/// The declared API version
8686
///
8787
/// The default value is to have no declared API version
88-
#[builder(default)]
89-
pub server_api: Option<ServerApi>,
88+
#[builder(skip, default)]
89+
pub(crate) server_api: Option<ServerApi>,
9090

9191
/// The options specifying how a TLS connection should be configured. If `tls_options` is
9292
/// `None`, then TLS will not be used for the connections.
@@ -118,7 +118,6 @@ impl ConnectionPoolOptions {
118118
.max_idle_time(options.max_idle_time)
119119
.max_pool_size(options.max_pool_size)
120120
.min_pool_size(options.min_pool_size)
121-
.server_api(options.server_api.clone())
122121
.tls_options(options.tls_options())
123122
.wait_queue_timeout(options.wait_queue_timeout)
124123
.build()

src/db/options.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,9 @@ pub enum ValidationLevel {
118118
#[serde(rename_all = "camelCase")]
119119
#[non_exhaustive]
120120
pub enum ValidationAction {
121+
/// Return an error if inserted documents do not pass the validation.
121122
Error,
123+
/// Raise a warning if inserted documents do not pass the validation.
122124
Warn,
123125
}
124126

src/error.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ impl std::ops::Deref for Error {
218218
}
219219

220220
/// The types of errors that can occur.
221+
#[allow(missing_docs)]
221222
#[derive(Debug, Error)]
222223
#[non_exhaustive]
223224
pub enum ErrorKind {
@@ -560,7 +561,11 @@ impl BulkWriteFailure {
560561
#[derive(Clone, Debug)]
561562
#[non_exhaustive]
562563
pub enum WriteFailure {
564+
/// An error that occurred due to not being able to satisfy a write concern.
563565
WriteConcernError(WriteConcernError),
566+
567+
/// An error that occurred during a write operation that wasn't due to being unable to satisfy a
568+
/// write concern.
564569
WriteError(WriteError),
565570
}
566571

src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
//! # }
7171
//! ```
7272
73+
#![warn(missing_docs)]
74+
#![warn(missing_crate_level_docs)]
75+
7376
#![cfg_attr(
7477
feature = "cargo-clippy",
7578
allow(

0 commit comments

Comments
 (0)