Skip to content

Commit 64e7818

Browse files
committed
fix doctest import issues
1 parent 56270e6 commit 64e7818

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ assert_matches = "1.2"
6161
serde_bytes = "0.11"
6262
pretty_assertions = "0.6.1"
6363
chrono = { version = "0.4", features = ["serde"] }
64+
uuid = { version = "0.8.1", features = ["serde", "v4"] }
6465

6566
[package.metadata.docs.rs]
6667
all-features = true

src/lib.rs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@
8282
//! [`bson!`](macro.bson.html) macro:
8383
//!
8484
//! ```rust
85-
//! # use bson::{bson, Bson};
85+
//! use bson::{bson, Bson};
86+
//!
8687
//! let string = Bson::String("hello world".to_string());
8788
//! let int = Bson::Int32(5);
8889
//! let array = Bson::Array(vec![Bson::Int32(5), Bson::Boolean(false)]);
@@ -105,7 +106,8 @@
105106
//!
106107
//! e.g.:
107108
//! ```rust
108-
//! # use bson::{bson, Bson};
109+
//! use bson::{bson, Bson};
110+
//!
109111
//! let value = Bson::Int32(5);
110112
//! let int = value.as_i32(); // Some(5)
111113
//! let bool = value.as_bool(); // None
@@ -126,8 +128,9 @@
126128
//! [`Document`](document/struct.Document.html)s can be created directly either from a byte
127129
//! reader containing BSON data or via the `doc!` macro:
128130
//! ```rust
129-
//! # use bson::{doc, Document};
130-
//! # use std::io::Read;
131+
//! use bson::{doc, Document};
132+
//! use std::io::Read;
133+
//!
131134
//! let mut bytes = hex::decode("0C0000001069000100000000").unwrap();
132135
//! let doc = Document::from_reader(&mut bytes.as_slice()).unwrap(); // { "i": 1 }
133136
//!
@@ -146,7 +149,8 @@
146149
//! access:
147150
//!
148151
//! ```rust
149-
//! # use bson::doc;
152+
//! use bson::doc;
153+
//!
150154
//! let doc = doc! {
151155
//! "string": "string",
152156
//! "bool": true,
@@ -173,8 +177,9 @@
173177
//!
174178
//! e.g.:
175179
//! ```rust
176-
//! # use serde::{Deserialize, Serialize};
177-
//! # use bson::{bson, Bson};
180+
//! use serde::{Deserialize, Serialize};
181+
//! use bson::{bson, Bson};
182+
//!
178183
//! #[derive(Serialize, Deserialize)]
179184
//! struct Person {
180185
//! name: String,
@@ -230,6 +235,7 @@
230235
//! # #[cfg(feature = "chrono-0_4")]
231236
//! # {
232237
//! use serde::{Serialize, Deserialize};
238+
//! use bson::doc;
233239
//!
234240
//! #[derive(Serialize, Deserialize)]
235241
//! struct Foo {
@@ -273,11 +279,12 @@
273279
//! # #[cfg(feature = "chrono-0_4")]
274280
//! # {
275281
//! use serde::{Serialize, Deserialize};
282+
//! use bson::doc;
276283
//!
277284
//! #[derive(Serialize, Deserialize)]
278285
//! struct Foo {
279286
//! // serializes as a String.
280-
//! uuid: Uuid,
287+
//! uuid: uuid::Uuid,
281288
//!
282289
//! // serializes as a BSON binary with subtype 4.
283290
//! // this requires the "uuid-0_8" feature flag

0 commit comments

Comments
 (0)