Rename all features

You can't add dependencies to implicit features, so move them all just
in case.
This commit is contained in:
Steven Fackler 2016-07-01 21:42:23 -04:00
parent c3aed4457f
commit f2cf6be6bc
11 changed files with 105 additions and 69 deletions

View File

@ -11,5 +11,5 @@ before_script:
- "./.travis/setup.sh" - "./.travis/setup.sh"
script: script:
- cargo test - cargo test
- cargo test --features "uuid rustc-serialize time unix_socket serde_json chrono with-openssl bit-vec eui48" - cargo test --features "with-uuid with-rustc-serialize with-time with-unix_socket with-serde_json with-chrono with-openssl with-bit-vec with-eui48"
- (test $TRAVIS_RUST_VERSION != "nightly" || cargo test --features nightly) - (test $TRAVIS_RUST_VERSION != "nightly" || cargo test --features nightly)

View File

@ -22,25 +22,34 @@ path = "tests/test.rs"
[features] [features]
nightly = [] nightly = []
with-bit-vec = ["bit-vec"]
with-chrono = ["chrono"]
with-eui48 = ["eui48"]
with-openssl = ["openssl", "openssl-verify"] with-openssl = ["openssl", "openssl-verify"]
with-rustc-serialize = ["rustc-serialize"]
with-security-framework = ["security-framework"]
with-serde_json = ["serde_json"]
with-time = ["time"]
with-unix_socket = ["unix_socket"]
with-uuid = ["uuid"]
[dependencies] [dependencies]
bufstream = "0.1" bufstream = "0.1"
byteorder = "0.5" byteorder = "0.5"
hex = "0.2"
log = "0.3" log = "0.3"
phf = "=0.7.15" phf = "=0.7.15"
hex = "0.2" bit-vec = { version = "0.4", optional = true }
rustc-serialize = { version = "0.3", optional = true }
chrono = { version = "0.2.14", optional = true } chrono = { version = "0.2.14", optional = true }
eui48 = { version = "0.1", optional = true }
openssl = { version = ">= 0.6.4, < 0.8", optional = true } openssl = { version = ">= 0.6.4, < 0.8", optional = true }
openssl-verify = { version = "0.1", optional = true } openssl-verify = { version = "0.1", optional = true }
rustc-serialize = { version = "0.3", optional = true }
security-framework = { version = "0.1.2", optional = true }
serde_json = { version = ">= 0.6, < 0.9", optional = true } serde_json = { version = ">= 0.6, < 0.9", optional = true }
time = { version = "0.1.14", optional = true } time = { version = "0.1.14", optional = true }
unix_socket = { version = "0.5", optional = true } unix_socket = { version = "0.5", optional = true }
uuid = { version = ">= 0.1, < 0.4", optional = true } uuid = { version = ">= 0.1, < 0.4", optional = true }
security-framework = { version = "0.1.2", optional = true }
bit-vec = { version = "0.4", optional = true }
eui48 = { version = "0.1", optional = true }
[dev-dependencies] [dev-dependencies]
url = "1.0" url = "1.0"

View File

@ -71,7 +71,7 @@ let conn = try!(Connection::connect("postgres://user:pass@host:port/database?arg
defaults to the value of `user` if not specified. The driver supports `trust`, defaults to the value of `user` if not specified. The driver supports `trust`,
`password`, and `md5` authentication. `password`, and `md5` authentication.
Unix domain sockets can be used as well by activating the `unix_socket` or Unix domain sockets can be used as well by activating the `with-unix_socket` or
`nightly` features. The `host` portion of the URI should be set to the absolute `nightly` features. The `host` portion of the URI should be set to the absolute
path to the directory containing the socket file. Since `/` is a reserved path to the directory containing the socket file. Since `/` is a reserved
character in URLs, the path should be URL encoded. If Postgres stored its socket character in URLs, the path should be URL encoded. If Postgres stored its socket
@ -288,39 +288,39 @@ crate.
### Unix socket connections ### Unix socket connections
Support for connections through Unix domain sockets is provided optionally by Support for connections through Unix domain sockets is provided optionally by
either the `unix_socket` or `nightly` features. It is only available on "unixy" either the `with-unix_socket` or `nightly` features. It is only available on
platforms such as OSX, BSD and Linux. "unixy" platforms such as OSX, BSD and Linux.
### UUID type ### UUID type
[UUID](http://www.postgresql.org/docs/9.4/static/datatype-uuid.html) support is [UUID](http://www.postgresql.org/docs/9.4/static/datatype-uuid.html) support is
provided optionally by the `uuid` feature, which adds `ToSql` and `FromSql` provided optionally by the `with-uuid` feature, which adds `ToSql` and `FromSql`
implementations for `uuid`'s `Uuid` type. implementations for `uuid`'s `Uuid` type.
### JSON/JSONB types ### JSON/JSONB types
[JSON and JSONB](http://www.postgresql.org/docs/9.4/static/datatype-json.html) [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 support is provided optionally by the `with-rustc-serialize` feature, which adds
`ToSql` and `FromSql` implementations for `rustc-serialize`'s `Json` type, and `ToSql` and `FromSql` implementations for `rustc-serialize`'s `Json` type, and
the `serde_json` feature, which adds implementations for `serde_json`'s `Value` the `with-serde_json` feature, which adds implementations for `serde_json`'s
type. `Value` type.
### TIMESTAMP/TIMESTAMPTZ/DATE/TIME types ### TIMESTAMP/TIMESTAMPTZ/DATE/TIME types
[Date and Time](http://www.postgresql.org/docs/9.1/static/datatype-datetime.html) [Date and Time](http://www.postgresql.org/docs/9.1/static/datatype-datetime.html)
support is provided optionally by the `time` feature, which adds `ToSql` and support is provided optionally by the `with-time` feature, which adds `ToSql`
`FromSql` implementations for `time`'s `Timespec` type, or the `chrono` and `FromSql` implementations for `time`'s `Timespec` type, or the `with-chrono`
feature, which adds `ToSql` and `FromSql` implementations for `chrono`'s feature, which adds `ToSql` and `FromSql` implementations for `chrono`'s
`DateTime`, `NaiveDateTime`, `NaiveDate` and `NaiveTime` types. `DateTime`, `NaiveDateTime`, `NaiveDate` and `NaiveTime` types.
### BIT/VARBIT types ### BIT/VARBIT types
[BIT and VARBIT](http://www.postgresql.org/docs/9.4/static/datatype-bit.html) [BIT and VARBIT](http://www.postgresql.org/docs/9.4/static/datatype-bit.html)
support is provided optionally by the `bit-vec` feature, which adds `ToSql` and support is provided optionally by the `with-bit-vec` feature, which adds `ToSql`
`FromSql` implementations for `bit-vec`'s `BitVec` type. and `FromSql` implementations for `bit-vec`'s `BitVec` type.
### MACADDR type ### MACADDR type
[MACADDR](http://www.postgresql.org/docs/9.4/static/datatype-net-types.html#DATATYPE-MACADDR) [MACADDR](http://www.postgresql.org/docs/9.4/static/datatype-net-types.html#DATATYPE-MACADDR)
support is provided optionally by the `eui48` feature, which adds `ToSql` and support is provided optionally by the `with-eui48` feature, which adds `ToSql`
`FromSql` implementations for `eui48`'s `MacAddress` type. and `FromSql` implementations for `eui48`'s `MacAddress` type.

29
src/feature_check.rs Normal file
View File

@ -0,0 +1,29 @@
#[cfg(all(feature = "bit-vec", not(feature = "with-bit-vec")))]
const _CHECK: BitVecFeatureRenamedSeeDocs = ();
#[cfg(all(feature = "chrono", not(feature = "with-chrono")))]
const _CHECK: ChronoFeatureRenamedSeeDocs = ();
#[cfg(all(feature = "eui48", not(feature = "with-eui48")))]
const _CHECK: Eui48FeatureRenamedSeeDocs = ();
#[cfg(all(feature = "openssl", not(feature = "with-openssl")))]
const _CHECK: OpensslFeatureRenamedSeeDocs = ();
#[cfg(all(feature = "rustc-serialize", not(feature = "with-rustc-serialize")))]
const _CHECK: RustcSerializeFeatureRenamedSeeDocs = ();
#[cfg(all(feature = "security-framework", not(feature = "with-security-framework")))]
const _CHECK: SecurityFrameworkFeatureRenamedSeeDocs = ();
#[cfg(all(feature = "serde_json", not(feature = "with-serde_json")))]
const _CHECK: SerdeJsonFeatureRenamedSeeDocs = ();
#[cfg(all(feature = "time", not(feature = "with-time")))]
const _CHECK: TimeFeatureRenamedSeeDocs = ();
#[cfg(all(feature = "unix_socket", not(feature = "with-unix_socket")))]
const _CHECK: UnixSocketFeatureRenamedSeeDocs = ();
#[cfg(all(feature = "uuid", not(feature = "with-uuid")))]
const _CHECK: UuidFeatureRenamedSeeDocs = ();

View File

@ -7,12 +7,9 @@ use std::fmt;
#[cfg(feature = "with-openssl")] #[cfg(feature = "with-openssl")]
pub mod openssl; pub mod openssl;
#[cfg(feature = "security-framework")] #[cfg(feature = "with-security-framework")]
pub mod security_framework; pub mod security_framework;
#[cfg(all(feature = "openssl", not(feature = "with-openssl")))]
const _CHECK: OpensslFeatureRenamedSeeDocs = "";
/// A trait implemented by TLS adaptors. /// A trait implemented by TLS adaptors.
pub trait TlsStream: fmt::Debug + Read + Write + Send { pub trait TlsStream: fmt::Debug + Read + Write + Send {
/// Returns a reference to the underlying `Stream`. /// Returns a reference to the underlying `Stream`.

View File

@ -17,7 +17,7 @@ impl TlsStream for SslStream<Stream> {
/// A `TlsHandshake` implementation that uses the Security Framework. /// A `TlsHandshake` implementation that uses the Security Framework.
/// ///
/// Requires the `security-framework` feature. /// Requires the `with-security-framework` feature.
#[derive(Debug)] #[derive(Debug)]
pub struct SecurityFramework(ClientBuilder); pub struct SecurityFramework(ClientBuilder);

View File

@ -49,7 +49,7 @@ extern crate hex;
#[macro_use] #[macro_use]
extern crate log; extern crate log;
extern crate phf; extern crate phf;
#[cfg(feature = "unix_socket")] #[cfg(feature = "with-unix_socket")]
extern crate unix_socket; extern crate unix_socket;
use bufstream::BufStream; use bufstream::BufStream;
@ -64,7 +64,7 @@ use std::mem;
use std::result; use std::result;
use std::sync::Arc; use std::sync::Arc;
use std::time::Duration; use std::time::Duration;
#[cfg(any(feature = "unix_socket", all(unix, feature = "nightly")))] #[cfg(any(feature = "with-unix_socket", all(unix, feature = "nightly")))]
use std::path::PathBuf; use std::path::PathBuf;
use error::{Error, ConnectError, SqlState, DbError}; use error::{Error, ConnectError, SqlState, DbError};
@ -81,6 +81,7 @@ use transaction::{Transaction, IsolationLevel};
#[macro_use] #[macro_use]
mod macros; mod macros;
mod feature_check;
mod md5; mod md5;
mod message; mod message;
mod priv_io; mod priv_io;
@ -165,14 +166,14 @@ impl<'a> IntoConnectParams for &'a str {
impl IntoConnectParams for Url { impl IntoConnectParams for Url {
fn into_connect_params(self) -> result::Result<ConnectParams, Box<StdError + Sync + Send>> { fn into_connect_params(self) -> result::Result<ConnectParams, Box<StdError + Sync + Send>> {
#[cfg(any(feature = "unix_socket", all(unix, feature = "nightly")))] #[cfg(any(feature = "with-unix_socket", all(unix, feature = "nightly")))]
fn make_unix(maybe_path: String) fn make_unix(maybe_path: String)
-> result::Result<ConnectTarget, Box<StdError + Sync + Send>> { -> result::Result<ConnectTarget, Box<StdError + Sync + Send>> {
Ok(ConnectTarget::Unix(PathBuf::from(maybe_path))) Ok(ConnectTarget::Unix(PathBuf::from(maybe_path)))
} }
#[cfg(not(any(feature = "unix_socket", all(unix, feature = "nightly"))))] #[cfg(not(any(feature = "with-unix_socket", all(unix, feature = "nightly"))))]
fn make_unix(_: String) -> result::Result<ConnectTarget, Box<StdError + Sync + Send>> { fn make_unix(_: String) -> result::Result<ConnectTarget, Box<StdError + Sync + Send>> {
Err("unix socket support requires the `unix_socket` or `nightly` features".into()) Err("unix socket support requires the `with-unix_socket` or `nightly` features".into())
} }
let Url { host, port, user, path: url::Path { mut path, query: options, .. }, .. } = self; let Url { host, port, user, path: url::Path { mut path, query: options, .. }, .. } = self;
@ -983,13 +984,13 @@ impl Connection {
/// (5432) is used if none is specified. The database name defaults to the /// (5432) is used if none is specified. The database name defaults to the
/// username if not specified. /// username if not specified.
/// ///
/// Connection via Unix sockets is supported with either the `unix_socket` /// Connection via Unix sockets is supported with either the
/// or `nightly` features. To connect to the server via Unix sockets, `host` /// `with-unix_socket` or `nightly` features. To connect to the server via
/// should be set to the absolute path of the directory containing the /// Unix sockets, `host` should be set to the absolute path of the directory
/// socket file. Since `/` is a reserved character in URLs, the path should /// containing the socket file. Since `/` is a reserved character in URLs,
/// be URL encoded. If the path contains non-UTF 8 characters, a /// the path should be URL encoded. If the path contains non-UTF 8
/// `ConnectParams` struct should be created manually and passed in. Note /// characters, a `ConnectParams` struct should be created manually and
/// that Postgres does not support SSL over Unix sockets. /// passed in. Note that Postgres does not support SSL over Unix sockets.
/// ///
/// # Examples /// # Examples
/// ///
@ -1011,7 +1012,7 @@ impl Connection {
/// use postgres::{Connection, UserInfo, ConnectParams, TlsMode, ConnectTarget}; /// use postgres::{Connection, UserInfo, ConnectParams, TlsMode, ConnectTarget};
/// # use std::path::PathBuf; /// # use std::path::PathBuf;
/// ///
/// # #[cfg(feature = "unix_socket")] /// # #[cfg(feature = "with-unix_socket")]
/// # fn f() { /// # fn f() {
/// # let some_crazy_path = PathBuf::new(); /// # let some_crazy_path = PathBuf::new();
/// let params = ConnectParams { /// let params = ConnectParams {

View File

@ -6,9 +6,9 @@ use std::fmt;
use std::net::TcpStream; use std::net::TcpStream;
use std::time::Duration; use std::time::Duration;
use bufstream::BufStream; use bufstream::BufStream;
#[cfg(feature = "unix_socket")] #[cfg(feature = "with-unix_socket")]
use unix_socket::UnixStream; use unix_socket::UnixStream;
#[cfg(all(not(feature = "unix_socket"), all(unix, feature = "nightly")))] #[cfg(all(not(feature = "with-unix_socket"), all(unix, feature = "nightly")))]
use std::os::unix::net::UnixStream; use std::os::unix::net::UnixStream;
#[cfg(unix)] #[cfg(unix)]
use std::os::unix::io::{AsRawFd, RawFd}; use std::os::unix::io::{AsRawFd, RawFd};
@ -33,7 +33,7 @@ impl StreamOptions for BufStream<Box<TlsStream>> {
fn set_read_timeout(&self, timeout: Option<Duration>) -> io::Result<()> { fn set_read_timeout(&self, timeout: Option<Duration>) -> io::Result<()> {
match self.get_ref().get_ref().0 { match self.get_ref().get_ref().0 {
InternalStream::Tcp(ref s) => s.set_read_timeout(timeout), InternalStream::Tcp(ref s) => s.set_read_timeout(timeout),
#[cfg(any(feature = "unix_socket", all(unix, feature = "nightly")))] #[cfg(any(feature = "with-unix_socket", all(unix, feature = "nightly")))]
InternalStream::Unix(ref s) => s.set_read_timeout(timeout), InternalStream::Unix(ref s) => s.set_read_timeout(timeout),
} }
} }
@ -41,7 +41,7 @@ impl StreamOptions for BufStream<Box<TlsStream>> {
fn set_nonblocking(&self, nonblock: bool) -> io::Result<()> { fn set_nonblocking(&self, nonblock: bool) -> io::Result<()> {
match self.get_ref().get_ref().0 { match self.get_ref().get_ref().0 {
InternalStream::Tcp(ref s) => s.set_nonblocking(nonblock), InternalStream::Tcp(ref s) => s.set_nonblocking(nonblock),
#[cfg(any(feature = "unix_socket", all(unix, feature = "nightly")))] #[cfg(any(feature = "with-unix_socket", all(unix, feature = "nightly")))]
InternalStream::Unix(ref s) => s.set_nonblocking(nonblock), InternalStream::Unix(ref s) => s.set_nonblocking(nonblock),
} }
} }
@ -57,7 +57,7 @@ impl fmt::Debug for Stream {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
match self.0 { match self.0 {
InternalStream::Tcp(ref s) => fmt::Debug::fmt(s, fmt), InternalStream::Tcp(ref s) => fmt::Debug::fmt(s, fmt),
#[cfg(any(feature = "unix_socket", all(unix, feature = "nightly")))] #[cfg(any(feature = "with-unix_socket", all(unix, feature = "nightly")))]
InternalStream::Unix(ref s) => fmt::Debug::fmt(s, fmt), InternalStream::Unix(ref s) => fmt::Debug::fmt(s, fmt),
} }
} }
@ -94,7 +94,7 @@ impl AsRawFd for Stream {
fn as_raw_fd(&self) -> RawFd { fn as_raw_fd(&self) -> RawFd {
match self.0 { match self.0 {
InternalStream::Tcp(ref s) => s.as_raw_fd(), InternalStream::Tcp(ref s) => s.as_raw_fd(),
#[cfg(any(feature = "unix_socket", all(unix, feature = "nightly")))] #[cfg(any(feature = "with-unix_socket", all(unix, feature = "nightly")))]
InternalStream::Unix(ref s) => s.as_raw_fd(), InternalStream::Unix(ref s) => s.as_raw_fd(),
} }
} }
@ -112,7 +112,7 @@ impl AsRawSocket for Stream {
enum InternalStream { enum InternalStream {
Tcp(TcpStream), Tcp(TcpStream),
#[cfg(any(feature = "unix_socket", all(unix, feature = "nightly")))] #[cfg(any(feature = "with-unix_socket", all(unix, feature = "nightly")))]
Unix(UnixStream), Unix(UnixStream),
} }
@ -120,7 +120,7 @@ impl Read for InternalStream {
fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> { fn read(&mut self, buf: &mut [u8]) -> io::Result<usize> {
match *self { match *self {
InternalStream::Tcp(ref mut s) => s.read(buf), InternalStream::Tcp(ref mut s) => s.read(buf),
#[cfg(any(feature = "unix_socket", all(unix, feature = "nightly")))] #[cfg(any(feature = "with-unix_socket", all(unix, feature = "nightly")))]
InternalStream::Unix(ref mut s) => s.read(buf), InternalStream::Unix(ref mut s) => s.read(buf),
} }
} }
@ -130,7 +130,7 @@ impl Write for InternalStream {
fn write(&mut self, buf: &[u8]) -> io::Result<usize> { fn write(&mut self, buf: &[u8]) -> io::Result<usize> {
match *self { match *self {
InternalStream::Tcp(ref mut s) => s.write(buf), InternalStream::Tcp(ref mut s) => s.write(buf),
#[cfg(any(feature = "unix_socket", all(unix, feature = "nightly")))] #[cfg(any(feature = "with-unix_socket", all(unix, feature = "nightly")))]
InternalStream::Unix(ref mut s) => s.write(buf), InternalStream::Unix(ref mut s) => s.write(buf),
} }
} }
@ -138,7 +138,7 @@ impl Write for InternalStream {
fn flush(&mut self) -> io::Result<()> { fn flush(&mut self) -> io::Result<()> {
match *self { match *self {
InternalStream::Tcp(ref mut s) => s.flush(), InternalStream::Tcp(ref mut s) => s.flush(),
#[cfg(any(feature = "unix_socket", all(unix, feature = "nightly")))] #[cfg(any(feature = "with-unix_socket", all(unix, feature = "nightly")))]
InternalStream::Unix(ref mut s) => s.flush(), InternalStream::Unix(ref mut s) => s.flush(),
} }
} }
@ -150,7 +150,7 @@ fn open_socket(params: &ConnectParams) -> Result<InternalStream, ConnectError> {
ConnectTarget::Tcp(ref host) => { ConnectTarget::Tcp(ref host) => {
Ok(try!(TcpStream::connect(&(&**host, port)).map(InternalStream::Tcp))) Ok(try!(TcpStream::connect(&(&**host, port)).map(InternalStream::Tcp)))
} }
#[cfg(any(feature = "unix_socket", all(unix, feature = "nightly")))] #[cfg(any(feature = "with-unix_socket", all(unix, feature = "nightly")))]
ConnectTarget::Unix(ref path) => { ConnectTarget::Unix(ref path) => {
let path = path.join(&format!(".s.PGSQL.{}", port)); let path = path.join(&format!(".s.PGSQL.{}", port));
Ok(try!(UnixStream::connect(&path).map(InternalStream::Unix))) Ok(try!(UnixStream::connect(&path).map(InternalStream::Unix)))
@ -184,7 +184,7 @@ pub fn initialize_stream(params: &ConnectParams,
// Postgres doesn't support SSL over unix sockets // Postgres doesn't support SSL over unix sockets
let host = match params.target { let host = match params.target {
ConnectTarget::Tcp(ref host) => host, ConnectTarget::Tcp(ref host) => host,
#[cfg(any(feature = "unix_socket", all(unix, feature = "nightly")))] #[cfg(any(feature = "with-unix_socket", all(unix, feature = "nightly")))]
ConnectTarget::Unix(_) => return Err(ConnectError::Io(::bad_response())), ConnectTarget::Unix(_) => return Err(ConnectError::Io(::bad_response())),
}; };

View File

@ -54,19 +54,19 @@ pub fn __to_sql_checked<T>(v: &T, ty: &Type, out: &mut Write, ctx: &SessionInfo)
v.to_sql(ty, out, ctx) v.to_sql(ty, out, ctx)
} }
#[cfg(feature = "bit-vec")] #[cfg(feature = "with-bit-vec")]
mod bit_vec; mod bit_vec;
#[cfg(feature = "uuid")] #[cfg(feature = "with-uuid")]
mod uuid; mod uuid;
#[cfg(feature = "time")] #[cfg(feature = "with-time")]
mod time; mod time;
#[cfg(feature = "rustc-serialize")] #[cfg(feature = "with-rustc-serialize")]
mod rustc_serialize; mod rustc_serialize;
#[cfg(feature = "serde_json")] #[cfg(feature = "with-serde_json")]
mod serde_json; mod serde_json;
#[cfg(feature = "chrono")] #[cfg(feature = "with-chrono")]
mod chrono; mod chrono;
#[cfg(feature = "eui48")] #[cfg(feature = "with-eui48")]
mod eui48; mod eui48;
mod special; mod special;
@ -273,8 +273,8 @@ impl WrongTypeNew for WrongType {
/// In addition, some implementations are provided for types in third party /// In addition, some implementations are provided for types in third party
/// crates. These are disabled by default; to opt into one of these /// crates. These are disabled by default; to opt into one of these
/// implementations, activate the Cargo feature corresponding to the crate's /// implementations, activate the Cargo feature corresponding to the crate's
/// name. For example, the `serde_json` feature enables the implementation for /// name prefixed by `with-`. For example, the `with-serde_json` feature enables
/// the `serde_json::Value` type. /// the implementation for the `serde_json::Value` type.
/// ///
/// | Rust type | Postgres type(s) | /// | Rust type | Postgres type(s) |
/// |---------------------------------|-------------------------------------| /// |---------------------------------|-------------------------------------|
@ -525,8 +525,8 @@ pub enum IsNull {
/// In addition, some implementations are provided for types in third party /// In addition, some implementations are provided for types in third party
/// crates. These are disabled by default; to opt into one of these /// crates. These are disabled by default; to opt into one of these
/// implementations, activate the Cargo feature corresponding to the crate's /// implementations, activate the Cargo feature corresponding to the crate's
/// name. For example, the `serde_json` feature enables the implementation for /// name prefixed by `with-`. For example, the `with-serde_json` feature enables
/// the `serde_json::Value` type. /// the implementation for the `serde_json::Value` type.
/// ///
/// | Rust type | Postgres type(s) | /// | Rust type | Postgres type(s) |
/// |---------------------------------|-------------------------------------| /// |---------------------------------|-------------------------------------|

View File

@ -3,7 +3,7 @@ extern crate postgres;
extern crate url; extern crate url;
#[cfg(feature = "with-openssl")] #[cfg(feature = "with-openssl")]
extern crate openssl; extern crate openssl;
#[cfg(feature = "security-framework")] #[cfg(feature = "with-security-framework")]
extern crate security_framework; extern crate security_framework;
use std::thread; use std::thread;
@ -685,7 +685,7 @@ fn test_prefer_ssl_conn() {
} }
#[test] #[test]
#[cfg(feature = "security-framework")] #[cfg(feature = "with-security-framework")]
fn security_framework_ssl() { fn security_framework_ssl() {
use postgres::io::security_framework::SecurityFramework; use postgres::io::security_framework::SecurityFramework;
use security_framework::certificate::SecCertificate; use security_framework::certificate::SecCertificate;

View File

@ -8,19 +8,19 @@ use postgres::{Connection, TlsMode, Result};
use postgres::error::Error; use postgres::error::Error;
use postgres::types::{ToSql, FromSql, WrongType, Type, IsNull, Kind, SessionInfo}; use postgres::types::{ToSql, FromSql, WrongType, Type, IsNull, Kind, SessionInfo};
#[cfg(feature = "bit-vec")] #[cfg(feature = "with-bit-vec")]
mod bit_vec; mod bit_vec;
#[cfg(feature = "eui48")] #[cfg(feature = "with-eui48")]
mod eui48; mod eui48;
#[cfg(feature = "uuid")] #[cfg(feature = "with-uuid")]
mod uuid; mod uuid;
#[cfg(feature = "time")] #[cfg(feature = "with-time")]
mod time; mod time;
#[cfg(feature = "rustc-serialize")] #[cfg(feature = "with-rustc-serialize")]
mod rustc_serialize; mod rustc_serialize;
#[cfg(feature = "serde_json")] #[cfg(feature = "with-serde_json")]
mod serde_json; mod serde_json;
#[cfg(feature = "chrono")] #[cfg(feature = "with-chrono")]
mod chrono; mod chrono;
fn test_type<T: PartialEq+FromSql+ToSql, S: fmt::Display>(sql_type: &str, checks: &[(T, S)]) { fn test_type<T: PartialEq+FromSql+ToSql, S: fmt::Display>(sql_type: &str, checks: &[(T, S)]) {