mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-27 13:46:32 +00:00
Rename cargo features in preparation for rustls support
This commit is contained in:
committed by
Ryan Leckey
parent
04f68632b4
commit
a161bcba05
@@ -16,7 +16,7 @@ authors = [
|
||||
features = ["all-databases", "all-types", "offline"]
|
||||
|
||||
[features]
|
||||
default = [ "runtime-async-std", "migrate" ]
|
||||
default = [ "runtime-async-std-native-tls", "migrate" ]
|
||||
migrate = [ "sha2", "crc" ]
|
||||
|
||||
# databases
|
||||
@@ -34,9 +34,14 @@ decimal = [ "rust_decimal", "num-bigint" ]
|
||||
json = [ "serde", "serde_json" ]
|
||||
|
||||
# runtimes
|
||||
runtime-async-std = [ "sqlx-rt/runtime-async-std" ]
|
||||
runtime-tokio = [ "sqlx-rt/runtime-tokio" ]
|
||||
runtime-actix = [ "sqlx-rt/runtime-actix" ]
|
||||
runtime-actix-native-tls = [ "sqlx-rt/runtime-actix-native-tls", "_rt-actix" ]
|
||||
runtime-async-std-native-tls = [ "sqlx-rt/runtime-async-std-native-tls", "_rt-async-std" ]
|
||||
runtime-tokio-native-tls = [ "sqlx-rt/runtime-tokio-native-tls", "_rt-tokio" ]
|
||||
|
||||
# for conditional compilation
|
||||
_rt-actix = []
|
||||
_rt-async-std = []
|
||||
_rt-tokio = []
|
||||
|
||||
# support offline/decoupled building (enables serialization of `Describe`)
|
||||
offline = [ "serde", "either/serde" ]
|
||||
|
||||
@@ -67,10 +67,10 @@ async fn upgrade(stream: &mut MySqlStream, options: &MySqlConnectOptions) -> Res
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "runtime-async-std"))]
|
||||
#[cfg(not(feature = "_rt-async-std"))]
|
||||
let connector = builder.build().map_err(Error::tls)?;
|
||||
|
||||
#[cfg(feature = "runtime-async-std")]
|
||||
#[cfg(feature = "_rt-async-std")]
|
||||
let connector = builder;
|
||||
|
||||
stream.upgrade(&options.host, connector.into()).await?;
|
||||
|
||||
@@ -35,7 +35,7 @@ pub use ssl_mode::MySqlSslMode;
|
||||
/// # use sqlx_core::mysql::{MySqlConnectOptions, MySqlConnection, MySqlSslMode};
|
||||
/// #
|
||||
/// # fn main() {
|
||||
/// # #[cfg(feature = "runtime-async-std")]
|
||||
/// # #[cfg(feature = "_rt-async-std")]
|
||||
/// # sqlx_rt::async_std::task::block_on::<_, Result<(), Error>>(async move {
|
||||
/// // URI connection string
|
||||
/// let conn = MySqlConnection::connect("mysql://root:password@localhost/db").await?;
|
||||
|
||||
@@ -60,7 +60,7 @@ impl AsyncRead for Socket {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "runtime-actix", feature = "runtime-tokio"))]
|
||||
#[cfg(any(feature = "_rt-actix", feature = "_rt-tokio"))]
|
||||
fn poll_read_buf<B>(
|
||||
mut self: Pin<&mut Self>,
|
||||
cx: &mut Context<'_>,
|
||||
@@ -102,7 +102,7 @@ impl AsyncWrite for Socket {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "runtime-actix", feature = "runtime-tokio"))]
|
||||
#[cfg(any(feature = "_rt-actix", feature = "_rt-tokio"))]
|
||||
fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
|
||||
match &mut *self {
|
||||
Socket::Tcp(s) => Pin::new(s).poll_shutdown(cx),
|
||||
@@ -112,7 +112,7 @@ impl AsyncWrite for Socket {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-async-std")]
|
||||
#[cfg(feature = "_rt-async-std")]
|
||||
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
|
||||
match &mut *self {
|
||||
Socket::Tcp(s) => Pin::new(s).poll_close(cx),
|
||||
@@ -122,7 +122,7 @@ impl AsyncWrite for Socket {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "runtime-actix", feature = "runtime-tokio"))]
|
||||
#[cfg(any(feature = "_rt-actix", feature = "_rt-tokio"))]
|
||||
fn poll_write_buf<B>(
|
||||
mut self: Pin<&mut Self>,
|
||||
cx: &mut Context<'_>,
|
||||
|
||||
@@ -72,7 +72,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "runtime-actix", feature = "runtime-tokio"))]
|
||||
#[cfg(any(feature = "_rt-actix", feature = "_rt-tokio"))]
|
||||
fn poll_read_buf<B>(
|
||||
mut self: Pin<&mut Self>,
|
||||
cx: &mut Context<'_>,
|
||||
@@ -117,7 +117,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "runtime-actix", feature = "runtime-tokio"))]
|
||||
#[cfg(any(feature = "_rt-actix", feature = "_rt-tokio"))]
|
||||
fn poll_shutdown(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
|
||||
match &mut *self {
|
||||
MaybeTlsStream::Raw(s) => Pin::new(s).poll_shutdown(cx),
|
||||
@@ -127,7 +127,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "runtime-async-std")]
|
||||
#[cfg(feature = "_rt-async-std")]
|
||||
fn poll_close(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<io::Result<()>> {
|
||||
match &mut *self {
|
||||
MaybeTlsStream::Raw(s) => Pin::new(s).poll_close(cx),
|
||||
@@ -137,7 +137,7 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(any(feature = "runtime-actix", feature = "runtime-tokio"))]
|
||||
#[cfg(any(feature = "_rt-actix", feature = "_rt-tokio"))]
|
||||
fn poll_write_buf<B>(
|
||||
mut self: Pin<&mut Self>,
|
||||
cx: &mut Context<'_>,
|
||||
@@ -166,10 +166,10 @@ where
|
||||
match self {
|
||||
MaybeTlsStream::Raw(s) => s,
|
||||
|
||||
#[cfg(not(feature = "runtime-async-std"))]
|
||||
#[cfg(not(feature = "_rt-async-std"))]
|
||||
MaybeTlsStream::Tls(s) => s.get_ref().get_ref().get_ref(),
|
||||
|
||||
#[cfg(feature = "runtime-async-std")]
|
||||
#[cfg(feature = "_rt-async-std")]
|
||||
MaybeTlsStream::Tls(s) => s.get_ref(),
|
||||
|
||||
MaybeTlsStream::Upgrading => panic!(io::Error::from(io::ErrorKind::ConnectionAborted)),
|
||||
@@ -185,10 +185,10 @@ where
|
||||
match self {
|
||||
MaybeTlsStream::Raw(s) => s,
|
||||
|
||||
#[cfg(not(feature = "runtime-async-std"))]
|
||||
#[cfg(not(feature = "_rt-async-std"))]
|
||||
MaybeTlsStream::Tls(s) => s.get_mut().get_mut().get_mut(),
|
||||
|
||||
#[cfg(feature = "runtime-async-std")]
|
||||
#[cfg(feature = "_rt-async-std")]
|
||||
MaybeTlsStream::Tls(s) => s.get_mut(),
|
||||
|
||||
MaybeTlsStream::Upgrading => panic!(io::Error::from(io::ErrorKind::ConnectionAborted)),
|
||||
|
||||
@@ -84,10 +84,10 @@ async fn upgrade(stream: &mut PgStream, options: &PgConnectOptions) -> Result<bo
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(not(feature = "runtime-async-std"))]
|
||||
#[cfg(not(feature = "_rt-async-std"))]
|
||||
let connector = builder.build().map_err(Error::tls)?;
|
||||
|
||||
#[cfg(feature = "runtime-async-std")]
|
||||
#[cfg(feature = "_rt-async-std")]
|
||||
let connector = builder;
|
||||
|
||||
stream.upgrade(&options.host, connector.into()).await?;
|
||||
|
||||
@@ -150,7 +150,7 @@ impl PgListener {
|
||||
/// # use sqlx_core::postgres::PgListener;
|
||||
/// # use sqlx_core::error::Error;
|
||||
/// #
|
||||
/// # #[cfg(feature = "runtime-async-std")]
|
||||
/// # #[cfg(feature = "_rt-async-std")]
|
||||
/// # sqlx_rt::block_on::<_, Result<(), Error>>(async move {
|
||||
/// # let mut listener = PgListener::connect("postgres:// ...").await?;
|
||||
/// loop {
|
||||
@@ -183,7 +183,7 @@ impl PgListener {
|
||||
/// # use sqlx_core::postgres::PgListener;
|
||||
/// # use sqlx_core::error::Error;
|
||||
/// #
|
||||
/// # #[cfg(feature = "runtime-async-std")]
|
||||
/// # #[cfg(feature = "_rt-async-std")]
|
||||
/// # sqlx_rt::block_on::<_, Result<(), Error>>(async move {
|
||||
/// # let mut listener = PgListener::connect("postgres:// ...").await?;
|
||||
/// loop {
|
||||
|
||||
@@ -54,7 +54,7 @@ pub use ssl_mode::PgSslMode;
|
||||
/// # use sqlx_core::postgres::{PgConnectOptions, PgConnection, PgSslMode};
|
||||
/// #
|
||||
/// # fn main() {
|
||||
/// # #[cfg(feature = "runtime-async-std")]
|
||||
/// # #[cfg(feature = "_rt-async-std")]
|
||||
/// # sqlx_rt::async_std::task::block_on::<_, Result<(), Error>>(async move {
|
||||
/// // URI connection string
|
||||
/// let conn = PgConnection::connect("postgres://localhost/mydb").await?;
|
||||
|
||||
@@ -31,7 +31,7 @@ use std::{borrow::Cow, time::Duration};
|
||||
/// use std::str::FromStr;
|
||||
///
|
||||
/// # fn main() {
|
||||
/// # #[cfg(feature = "runtime-async-std")]
|
||||
/// # #[cfg(feature = "_rt-async-std")]
|
||||
/// # sqlx_rt::async_std::task::block_on::<_, Result<(), Error>>(async move {
|
||||
/// let conn = SqliteConnectOptions::from_str("sqlite://data.db")?
|
||||
/// .journal_mode(SqliteJournalMode::Wal)
|
||||
|
||||
Reference in New Issue
Block a user