summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.toml2
-rw-r--r--src/de.rs10
-rw-r--r--src/lib.rs8
3 files changed, 11 insertions, 9 deletions
diff --git a/Cargo.toml b/Cargo.toml
index d7cdc60..6c4990b 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,7 +4,7 @@ version = "0.0.1"
authors = ["Sam Scott <me@samjs.co.uk>"]
license = "MIT/Apache-2.0"
repository = "https://github.com/samscott89/serde_qs"
-# documentation = "https://docs.rs/serde_qs"
+documentation = "https://docs.rs/serde_qs"
description = "Querystrings for Serde"
categories = ["encoding", "web-programming"]
keywords = ["serde", "serialization", "querystring"]
diff --git a/src/de.rs b/src/de.rs
index ebc7e5f..b33e07b 100644
--- a/src/de.rs
+++ b/src/de.rs
@@ -53,7 +53,7 @@ impl Config {
// T::deserialize(Deserializer::with_config(self, input.as_bytes()))
}
}
-/// Deserializes a query-string from a `&[u8]`.
+/// Deserializes a querystring from a `&[u8]`.
///
/// ```
/// # #[macro_use]
@@ -84,7 +84,7 @@ pub fn from_bytes<T: de::Deserialize>(input: &[u8]) -> Result<T, Error> {
Config::default().from_bytes(input)
}
-/// Deserializes a query-string from a `&str`.
+/// Deserializes a querystring from a `&str`.
///
/// ```
/// # #[macro_use]
@@ -127,7 +127,7 @@ pub fn from_reader<T, R>(mut reader: R) -> Result<T, Error>
from_bytes(&buf)
}
-/// A deserializer for the query-string format.
+/// A deserializer for the querystring format.
///
/// Supported top-level outputs are structs and maps.
pub struct Deserializer {
@@ -376,7 +376,7 @@ impl<I: Iterator<Item = u8>> Parser<I> {
},
// Key is "[a..." so parse up to the closing "]"
0x20...0x7e => {
- let key = self.parse_key(b']', true).unwrap();
+ let key = self.parse_key(b']', true)?;
// key.into()
// println!("key: {:?}", key);
self.parse_map_value(key.into(), node)?;
@@ -392,7 +392,7 @@ impl<I: Iterator<Item = u8>> Parser<I> {
// This means the key should be a root key
// of the form "abc" or "abc[...]"
0x20...0x7e => {
- let key = self.parse_key(b'[', false).unwrap();
+ let key = self.parse_key(b'[', false)?;
self.parse_map_value(key.into(), node)?;
self.depth += 1;
Ok(true)
diff --git a/src/lib.rs b/src/lib.rs
index b647eb5..b14df1b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -22,14 +22,16 @@
//! Serializing/Deserializing is designed to work with maps and structs.
//!
//! ```
+//! #[macro_use]
+//! extern crate serde_derive;
+//! extern crate serde_qs as qs;
//!
-//!
-//! #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
+//! #[derive(Debug, PartialEq, Deserialize, Serialize)]
//! struct Address {
//! city: String,
//! postcode: String,
//! }
-//! #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
+//! #[derive(Debug, PartialEq, Deserialize, Serialize)]
//! struct QueryParams {
//! id: u8,
//! name: String,