diff --git a/.travis.yml b/.travis.yml
index 0b6d6758..09aab8ca 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -10,4 +10,4 @@ before_script:
- "./.travis/setup.sh"
script:
- cargo test
-- cargo test --features "uuid rustc-serialize time unix_socket serde chrono openssl"
+- cargo test --features "uuid rustc-serialize time unix_socket serde_json chrono openssl"
diff --git a/Cargo.toml b/Cargo.toml
index 77be35d1..4787b0bf 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -32,7 +32,7 @@ rustc-serialize = "0.3"
net2 = { version = "0.2", features = ["nightly"] }
chrono = { version = "0.2.14", optional = true }
openssl = { version = "0.6.4", optional = true }
-serde = { version = "0.3", optional = true }
+serde_json = { version = "0.6", optional = true }
time = { version = "0.1.14", optional = true }
unix_socket = { version = ">= 0.3, < 0.5", optional = true, features = ["socket_timeout"] }
uuid = { version = "0.1", optional = true }
diff --git a/README.md b/README.md
index 4f611898..0b40b4fe 100644
--- a/README.md
+++ b/README.md
@@ -200,7 +200,7 @@ types. The driver currently supports the following conversions:
serialize::json::Json
and
- serde::json::Value
+ serde_json::Value
(optional)
|
JSON, JSONB |
@@ -284,7 +284,7 @@ implementations for `uuid`'s `Uuid` type.
[JSON and JSONB](http://www.postgresql.org/docs/9.4/static/datatype-json.html)
support is provided optionally by the `rustc-serialize` feature, which adds
`ToSql` and `FromSql` implementations for `rustc-serialize`'s `Json` type, and
-the `serde` feature, which adds implementations for `serde`'s `json::Value`
+the `serde` feature, which adds implementations for `serde_json`'s `Value`
type.
### TIMESTAMP/TIMESTAMPTZ/DATE/TIME types
diff --git a/src/types/mod.rs b/src/types/mod.rs
index 04149b33..febddb5c 100644
--- a/src/types/mod.rs
+++ b/src/types/mod.rs
@@ -49,8 +49,8 @@ mod time;
mod slice;
#[cfg(feature = "rustc-serialize")]
mod rustc_serialize;
-#[cfg(feature = "serde")]
-mod serde;
+#[cfg(feature = "serde_json")]
+mod serde_json;
#[cfg(feature = "chrono")]
mod chrono;
@@ -571,13 +571,13 @@ impl error::Error for WasNull {
/// In addition, some implementations are provided for types in third party
/// crates. These are disabled by default; to opt into one of these
/// implementations, activate the Cargo feature corresponding to the crate's
-/// name. For example, the `serde` feature enables the implementation for the
-/// `serde::json::Value` type.
+/// name. For example, the `serde_json` feature enables the implementation for
+/// the `serde_json::Value` type.
///
/// | Rust type | Postgres type(s) |
/// |-------------------------------------|-------------------------------------|
/// | serialize::json::Json | JSON, JSONB |
-/// | serde::json::Value | JSON, JSONB |
+/// | serde_json::Value | JSON, JSONB |
/// | time::Timespec | TIMESTAMP, TIMESTAMP WITH TIME ZONE |
/// | chrono::NaiveDateTime | TIMESTAMP |
/// | chrono::DateTime<UTC> | TIMESTAMP WITH TIME ZONE |
@@ -616,6 +616,7 @@ pub trait FromSql: Sized {
///
/// The default implementation returns
/// `Err(Error::Conversion(Box::new(WasNull))`.
+ #[allow(unused_variables)]
fn from_sql_null(ty: &Type, ctx: &SessionInfo) -> Result {
Err(Error::Conversion(Box::new(WasNull)))
}
@@ -776,13 +777,13 @@ pub enum IsNull {
/// In addition, some implementations are provided for types in third party
/// crates. These are disabled by default; to opt into one of these
/// implementations, activate the Cargo feature corresponding to the crate's
-/// name. For example, the `serde` feature enables the implementation for the
-/// `serde::json::Value` type.
+/// name. For example, the `serde_json` feature enables the implementation for
+/// the `serde_json::Value` type.
///
/// | Rust type | Postgres type(s) |
/// |-------------------------------------|-------------------------------------|
/// | serialize::json::Json | JSON, JSONB |
-/// | serde::json::Value | JSON, JSONB |
+/// | serde_json::Value | JSON, JSONB |
/// | time::Timespec | TIMESTAMP, TIMESTAMP WITH TIME ZONE |
/// | chrono::NaiveDateTime | TIMESTAMP |
/// | chrono::DateTime<UTC> | TIMESTAMP WITH TIME ZONE |
diff --git a/src/types/serde.rs b/src/types/serde_json.rs
similarity index 87%
rename from src/types/serde.rs
rename to src/types/serde_json.rs
index b5db60fc..839d3839 100644
--- a/src/types/serde.rs
+++ b/src/types/serde_json.rs
@@ -1,9 +1,9 @@
-extern crate serde;
+extern crate serde_json;
use std::error;
use std::io::prelude::*;
use byteorder::{ReadBytesExt, WriteBytesExt};
-use self::serde::json::{self, Value};
+use self::serde_json::Value;
use Result;
use error::Error;
@@ -18,7 +18,7 @@ impl FromSql for Value {
return Err(Error::Conversion(err));
}
}
- json::de::from_reader(raw).map_err(|err| Error::Conversion(Box::new(err)))
+ serde_json::de::from_reader(raw).map_err(|err| Error::Conversion(Box::new(err)))
}
accepts!(Type::Json, Type::Jsonb);
diff --git a/tests/types/mod.rs b/tests/types/mod.rs
index 9ffbdb07..0d67f4ee 100644
--- a/tests/types/mod.rs
+++ b/tests/types/mod.rs
@@ -13,8 +13,8 @@ mod uuid;
mod time;
#[cfg(feature = "rustc-serialize")]
mod rustc_serialize;
-#[cfg(feature = "serde")]
-mod serde;
+#[cfg(feature = "serde_json")]
+mod serde_json;
#[cfg(feature = "chrono")]
mod chrono;
diff --git a/tests/types/serde.rs b/tests/types/serde.rs
deleted file mode 100644
index 9e1fa95d..00000000
--- a/tests/types/serde.rs
+++ /dev/null
@@ -1,22 +0,0 @@
-extern crate serde;
-
-use self::serde::json::{self, Value};
-use types::test_type;
-
-#[test]
-fn test_json_params() {
- test_type("JSON", &[(Some(json::from_str::("[10, 11, 12]").unwrap()),
- "'[10, 11, 12]'"),
- (Some(json::from_str::("{\"f\": \"asd\"}").unwrap()),
- "'{\"f\": \"asd\"}'"),
- (None, "NULL")])
-}
-
-#[test]
-fn test_jsonb_params() {
- test_type("JSONB", &[(Some(json::from_str::("[10, 11, 12]").unwrap()),
- "'[10, 11, 12]'"),
- (Some(json::from_str::("{\"f\": \"asd\"}").unwrap()),
- "'{\"f\": \"asd\"}'"),
- (None, "NULL")])
-}
diff --git a/tests/types/serde_json.rs b/tests/types/serde_json.rs
new file mode 100644
index 00000000..37b7d90b
--- /dev/null
+++ b/tests/types/serde_json.rs
@@ -0,0 +1,22 @@
+extern crate serde_json;
+
+use self::serde_json::Value;
+use types::test_type;
+
+#[test]
+fn test_json_params() {
+ test_type("JSON", &[(Some(serde_json::from_str::("[10, 11, 12]").unwrap()),
+ "'[10, 11, 12]'"),
+ (Some(serde_json::from_str::("{\"f\": \"asd\"}").unwrap()),
+ "'{\"f\": \"asd\"}'"),
+ (None, "NULL")])
+}
+
+#[test]
+fn test_jsonb_params() {
+ test_type("JSONB", &[(Some(serde_json::from_str::("[10, 11, 12]").unwrap()),
+ "'[10, 11, 12]'"),
+ (Some(serde_json::from_str::("{\"f\": \"asd\"}").unwrap()),
+ "'{\"f\": \"asd\"}'"),
+ (None, "NULL")])
+}