summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock7
-rw-r--r--README.md2
-rw-r--r--serde_dhall/Cargo.toml3
-rw-r--r--serde_dhall/src/lib.rs3
4 files changed, 14 insertions, 1 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 31638a3..4b80022 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -174,6 +174,11 @@ dependencies = [
]
[[package]]
+name = "doc-comment"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
+[[package]]
name = "dtoa"
version = "0.4.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -964,6 +969,7 @@ version = "0.4.0"
dependencies = [
"dhall 0.4.0",
"dhall_proc_macros 0.4.0",
+ "doc-comment 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"reqwest 0.10.4 (registry+https://github.com/rust-lang/crates.io-index)",
"serde 1.0.104 (registry+https://github.com/rust-lang/crates.io-index)",
"url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
@@ -1331,6 +1337,7 @@ dependencies = [
"checksum ctor 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)" = "47c5e5ac752e18207b12e16b10631ae5f7f68f8805f335f9b817ead83d9ffce1"
"checksum difference 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
"checksum digest 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)" = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5"
+"checksum doc-comment 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fea41bba32d969b513997752735605054bc0dfa92b4c56bf1189f2e174be7a10"
"checksum dtoa 0.4.5 (registry+https://github.com/rust-lang/crates.io-index)" = "4358a9e11b9a09cf52383b451b49a169e8d797b68aa02301ff586d70d9661ea3"
"checksum either 1.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "bb1f6b1ce1c140482ea30ddd3335fc0024ac7ee112895426e0a629a6c20adfe3"
"checksum encoding_rs 0.8.22 (registry+https://github.com/rust-lang/crates.io-index)" = "cd8d03faa7fe0c1431609dfad7bbe827af30f82e1e2ae6f7ee4fca6bd764bc28"
diff --git a/README.md b/README.md
index cce65e3..8afcac6 100644
--- a/README.md
+++ b/README.md
@@ -58,7 +58,7 @@ use std::collections::BTreeMap;
let data = "{ x = 1, y = 1 + 1 } : { x: Natural, y: Natural }";
// Deserialize it to a Rust type.
-let deserialized_map: BTreeMap<String, usize> = serde_dhall::from_str(data)?;
+let deserialized_map: BTreeMap<String, usize> = serde_dhall::from_str(data).unwrap();
let mut expected_map = BTreeMap::new();
expected_map.insert("x".to_string(), 1);
diff --git a/serde_dhall/Cargo.toml b/serde_dhall/Cargo.toml
index 71a9b02..4e3cce7 100644
--- a/serde_dhall/Cargo.toml
+++ b/serde_dhall/Cargo.toml
@@ -15,3 +15,6 @@ dhall = { version = "=0.4.0", path = "../dhall" }
dhall_proc_macros = { version = "=0.4.0", path = "../dhall_proc_macros" }
reqwest = { version = "0.10", features = ["blocking"] }
url = "2.1"
+
+[dev-dependencies]
+doc-comment = "0.3"
diff --git a/serde_dhall/src/lib.rs b/serde_dhall/src/lib.rs
index 5b8f470..4250882 100644
--- a/serde_dhall/src/lib.rs
+++ b/serde_dhall/src/lib.rs
@@ -168,6 +168,9 @@
//! [serde]: https://docs.serde.rs/serde/
//! [serde::Deserialize]: https://docs.serde.rs/serde/trait.Deserialize.html
+#[cfg(doctest)]
+doc_comment::doctest!("../../README.md");
+
mod error;
/// Finer-grained control over deserializing Dhall
pub mod options;