mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-29 14:41:09 +00:00
Rename cargo features in preparation for rustls support
This commit is contained in:
committed by
Ryan Leckey
parent
04f68632b4
commit
a161bcba05
@@ -11,9 +11,15 @@ authors = [
|
||||
]
|
||||
|
||||
[features]
|
||||
runtime-actix = [ "actix-rt", "actix-threadpool", "tokio", "tokio-native-tls", "once_cell" ]
|
||||
runtime-async-std = [ "async-std", "async-native-tls" ]
|
||||
runtime-tokio = [ "tokio", "tokio-native-tls", "once_cell" ]
|
||||
runtime-actix-native-tls = [ "_rt-actix", "_tls-native-tls", "tokio-native-tls" ]
|
||||
runtime-async-std-native-tls = [ "_rt-async-std", "_tls-native-tls", "async-native-tls" ]
|
||||
runtime-tokio-native-tls = [ "_rt-tokio", "_tls-native-tls", "tokio-native-tls" ]
|
||||
|
||||
# Not used directly and not re-exported from sqlx
|
||||
_rt-actix = [ "actix-rt", "actix-threadpool", "tokio", "once_cell" ]
|
||||
_rt-async-std = [ "async-std" ]
|
||||
_rt-tokio = [ "tokio", "once_cell" ]
|
||||
_tls-native-tls = [ "native-tls" ]
|
||||
|
||||
[dependencies]
|
||||
async-native-tls = { version = "0.3.3", optional = true }
|
||||
@@ -22,5 +28,5 @@ actix-threadpool = { version = "0.3.2", optional = true }
|
||||
async-std = { version = "1.6.0", features = [ "unstable" ], optional = true }
|
||||
tokio = { version = "0.2.21", optional = true, features = [ "blocking", "stream", "fs", "tcp", "uds", "macros", "rt-core", "rt-threaded", "time", "dns", "io-util" ] }
|
||||
tokio-native-tls = { version = "0.1.0", optional = true }
|
||||
native-tls = "0.2.4"
|
||||
native-tls = { version = "0.2.4", optional = true }
|
||||
once_cell = { version = "1.4", features = ["std"], optional = true }
|
||||
|
||||
@@ -1,21 +1,24 @@
|
||||
#[cfg(not(any(
|
||||
feature = "runtime-actix",
|
||||
feature = "runtime-async-std",
|
||||
feature = "runtime-tokio",
|
||||
feature = "runtime-actix-native-tls",
|
||||
feature = "runtime-async-std-native-tls",
|
||||
feature = "runtime-tokio-native-tls",
|
||||
)))]
|
||||
compile_error!(
|
||||
"one of 'runtime-actix', 'runtime-async-std' or 'runtime-tokio' features must be enabled"
|
||||
"one of the features ['runtime-actix-native-tls', 'runtime-async-std-native-tls', \
|
||||
'runtime-tokio-native-tls'] must be enabled"
|
||||
);
|
||||
|
||||
#[cfg(any(
|
||||
all(feature = "runtime-actix", feature = "runtime-async-std"),
|
||||
all(feature = "runtime-actix", feature = "runtime-tokio"),
|
||||
all(feature = "runtime-async-std", feature = "runtime-tokio"),
|
||||
all(feature = "_rt-actix", feature = "_rt-async-std"),
|
||||
all(feature = "_rt-actix", feature = "_rt-tokio"),
|
||||
all(feature = "_rt-async-std", feature = "_rt-tokio"),
|
||||
))]
|
||||
compile_error!(
|
||||
"only one of 'runtime-actix', 'runtime-async-std' or 'runtime-tokio' features can be enabled"
|
||||
"only one of ['runtime-actix-native-tls', 'runtime-async-std-native-tls', \
|
||||
'runtime-tokio-native-tls'] can be enabled"
|
||||
);
|
||||
|
||||
#[cfg(all(feature = "_tls-native-tls"))]
|
||||
pub use native_tls::{self, Error as TlsError};
|
||||
|
||||
//
|
||||
@@ -23,8 +26,8 @@ pub use native_tls::{self, Error as TlsError};
|
||||
//
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "runtime-tokio", feature = "runtime-actix"),
|
||||
not(feature = "runtime-async-std"),
|
||||
any(feature = "_rt-tokio", feature = "_rt-actix"),
|
||||
not(feature = "_rt-async-std"),
|
||||
))]
|
||||
pub use tokio::{
|
||||
self, fs, io::AsyncRead, io::AsyncReadExt, io::AsyncWrite, io::AsyncWriteExt, net::TcpStream,
|
||||
@@ -33,12 +36,16 @@ pub use tokio::{
|
||||
|
||||
#[cfg(all(
|
||||
unix,
|
||||
any(feature = "runtime-tokio", feature = "runtime-actix"),
|
||||
not(feature = "runtime-async-std"),
|
||||
any(feature = "_rt-tokio", feature = "_rt-actix"),
|
||||
not(feature = "_rt-async-std"),
|
||||
))]
|
||||
pub use tokio::net::UnixStream;
|
||||
|
||||
#[cfg(all(feature = "tokio-native-tls", not(feature = "async-native-tls")))]
|
||||
#[cfg(all(
|
||||
feature = "_tls-native-tls",
|
||||
any(feature = "_rt-tokio", feature = "_rt-actix"),
|
||||
not(feature = "_rt-async-std"),
|
||||
))]
|
||||
pub use tokio_native_tls::{TlsConnector, TlsStream};
|
||||
|
||||
//
|
||||
@@ -46,8 +53,8 @@ pub use tokio_native_tls::{TlsConnector, TlsStream};
|
||||
//
|
||||
|
||||
#[cfg(all(
|
||||
feature = "runtime-tokio",
|
||||
not(any(feature = "runtime-actix", feature = "runtime-async-std",))
|
||||
feature = "_rt-tokio",
|
||||
not(any(feature = "_rt-actix", feature = "_rt-async-std")),
|
||||
))]
|
||||
#[macro_export]
|
||||
macro_rules! blocking {
|
||||
@@ -60,12 +67,12 @@ macro_rules! blocking {
|
||||
// actix
|
||||
//
|
||||
|
||||
#[cfg(feature = "runtime-actix")]
|
||||
#[cfg(feature = "_rt-actix")]
|
||||
pub use {actix_rt, actix_threadpool};
|
||||
|
||||
#[cfg(all(
|
||||
feature = "runtime-actix",
|
||||
not(any(feature = "runtime-tokio", feature = "runtime-async-std",))
|
||||
feature = "_rt-actix",
|
||||
not(any(feature = "_rt-tokio", feature = "_rt-async-std")),
|
||||
))]
|
||||
#[macro_export]
|
||||
macro_rules! blocking {
|
||||
@@ -82,8 +89,8 @@ macro_rules! blocking {
|
||||
//
|
||||
|
||||
#[cfg(all(
|
||||
feature = "runtime-async-std",
|
||||
not(any(feature = "runtime-actix", feature = "runtime-tokio",))
|
||||
feature = "_rt-async-std",
|
||||
not(any(feature = "_rt-actix", feature = "_rt-tokio")),
|
||||
))]
|
||||
pub use async_std::{
|
||||
self, fs, future::timeout, io::prelude::ReadExt as AsyncReadExt,
|
||||
@@ -92,8 +99,8 @@ pub use async_std::{
|
||||
};
|
||||
|
||||
#[cfg(all(
|
||||
feature = "runtime-async-std",
|
||||
not(any(feature = "runtime-actix", feature = "runtime-tokio",))
|
||||
feature = "_rt-async-std",
|
||||
not(any(feature = "_rt-actix", feature = "_rt-tokio")),
|
||||
))]
|
||||
#[macro_export]
|
||||
macro_rules! blocking {
|
||||
@@ -104,8 +111,8 @@ macro_rules! blocking {
|
||||
|
||||
#[cfg(all(
|
||||
unix,
|
||||
feature = "runtime-async-std",
|
||||
not(any(feature = "runtime-actix", feature = "runtime-tokio",))
|
||||
feature = "_rt-async-std",
|
||||
not(any(feature = "_rt-actix", feature = "_rt-tokio")),
|
||||
))]
|
||||
pub use async_std::os::unix::net::UnixStream;
|
||||
|
||||
@@ -113,14 +120,14 @@ pub use async_std::os::unix::net::UnixStream;
|
||||
pub use async_native_tls::{TlsConnector, TlsStream};
|
||||
|
||||
#[cfg(all(
|
||||
feature = "runtime-async-std",
|
||||
not(any(feature = "runtime-actix", feature = "runtime-tokio"))
|
||||
feature = "_rt-async-std",
|
||||
not(any(feature = "_rt-actix", feature = "_rt-tokio")),
|
||||
))]
|
||||
pub use async_std::task::block_on;
|
||||
|
||||
#[cfg(all(
|
||||
feature = "runtime-async-std",
|
||||
not(any(feature = "runtime-actix", feature = "runtime-tokio"))
|
||||
feature = "_rt-async-std",
|
||||
not(any(feature = "_rt-actix", feature = "_rt-tokio")),
|
||||
))]
|
||||
pub fn enter_runtime<F, R>(f: F) -> R
|
||||
where
|
||||
@@ -131,12 +138,12 @@ where
|
||||
}
|
||||
|
||||
#[cfg(all(
|
||||
any(feature = "runtime-tokio", feature = "runtime-actix"),
|
||||
not(feature = "runtime-async-std")
|
||||
any(feature = "_rt-tokio", feature = "_rt-actix"),
|
||||
not(feature = "_rt-async-std"),
|
||||
))]
|
||||
pub use tokio_runtime::{block_on, enter_runtime};
|
||||
|
||||
#[cfg(any(feature = "runtime-tokio", feature = "runtime-actix"))]
|
||||
#[cfg(any(feature = "_rt-tokio", feature = "_rt-actix"))]
|
||||
mod tokio_runtime {
|
||||
use once_cell::sync::Lazy;
|
||||
use tokio::runtime::{self, Runtime};
|
||||
|
||||
Reference in New Issue
Block a user