|
5 | 5 | //! [`Client::with_uri_str`](struct.Client.html#method.with_uri_str):
|
6 | 6 | //!
|
7 | 7 | //! ```rust
|
| 8 | +//! # #[cfg(not(feature = "sync"))] |
8 | 9 | //! # use mongodb::{Client, error::Result};
|
9 | 10 | //! #
|
| 11 | +//! # #[cfg(not(feature = "sync"))] |
10 | 12 | //! # async fn make_client() -> Result<Client> {
|
11 | 13 | //! let client = Client::with_uri_str("mongodb://localhost:27017/").await?;
|
12 | 14 | //! # Ok(client)
|
|
19 | 21 | //! # use mongodb::{
|
20 | 22 | //! # error::Result,
|
21 | 23 | //! # options::{StreamAddress, ClientOptions},
|
22 |
| -//! # Client, |
23 | 24 | //! # };
|
| 25 | +//! # #[cfg(feature = "sync")] |
| 26 | +//! # use mongodb::sync::Client; |
| 27 | +//! # #[cfg(not(feature = "sync"))] |
| 28 | +//! # use mongodb::Client; |
24 | 29 | //! #
|
25 | 30 | //! # fn make_client() -> Result<Client> {
|
26 | 31 | //! let options = ClientOptions::builder()
|
|
42 | 47 | //!
|
43 | 48 | //! ```rust
|
44 | 49 | //! # use bson::{bson, doc};
|
45 |
| -//! # use mongodb::{Client, error::Result}; |
| 50 | +//! # use mongodb::error::Result; |
| 51 | +//! # #[cfg(not(feature = "sync"))] |
| 52 | +//! # use mongodb::Client; |
46 | 53 | //! #
|
| 54 | +//! # #[cfg(not(feature = "sync"))] |
47 | 55 | //! # async fn do_stuff() -> Result<()> {
|
48 |
| -//! # let client = Client::with_uri_str("mongodb://localhost:27017").await?; |
| 56 | +//! # let client = Client::with_uri_str("mongodb://example.com").await?; |
49 | 57 | //! #
|
50 | 58 | //! let db = client.database("some_db");
|
51 | 59 | //! for coll_name in db.list_collection_names(None).await? {
|
@@ -133,16 +141,20 @@ define_if_single_runtime_enabled! {
|
133 | 141 | pub use coll::Namespace;
|
134 | 142 | }
|
135 | 143 |
|
136 |
| -#[cfg(all(feature = "tokio-runtime", feature = "async-std-runtime", not(feature = "sync")))] |
| 144 | +#[cfg(all( |
| 145 | + feature = "tokio-runtime", |
| 146 | + feature = "async-std-runtime", |
| 147 | + not(feature = "sync") |
| 148 | +))] |
137 | 149 | compile_error!(
|
138 | 150 | "`tokio-runtime` and `async-runtime` can't both be enabled; either disable \
|
139 | 151 | `async-std-runtime` or set `default-features = false` in your Cargo.toml"
|
140 | 152 | );
|
141 | 153 |
|
142 | 154 | #[cfg(all(feature = "tokio-runtime", feature = "sync"))]
|
143 | 155 | compile_error!(
|
144 |
| - "`tokio-runtime` and `sync` can't both be enabled; either disable \ |
145 |
| - `sync` or set `default-features = false` in your Cargo.toml" |
| 156 | + "`tokio-runtime` and `sync` can't both be enabled; either disable `sync` or set \ |
| 157 | + `default-features = false` in your Cargo.toml" |
146 | 158 | );
|
147 | 159 |
|
148 | 160 | #[cfg(all(not(feature = "tokio-runtime"), not(feature = "async-std-runtime")))]
|
|
0 commit comments