fix: expose runtime-actix in sqlx/Cargo.toml

This commit is contained in:
Ryan Leckey 2020-06-01 05:34:52 -07:00
parent 884b523d43
commit a3053119fa
4 changed files with 9 additions and 11 deletions

View File

@ -38,7 +38,10 @@ rustdoc-args = ["--cfg", "docsrs"]
[features]
default = [ "macros", "runtime-async-std" ]
macros = [ "sqlx-macros" ]
tls = [ "sqlx-core/tls" ]
# [deprecated] TLS is not possible to disable due to it being conditional on multiple features
# Hopefully Cargo can handle this in the future
tls = [ ]
# offline building support in `sqlx-macros`
offline = ["sqlx-macros/offline", "sqlx-core/offline"]
@ -50,6 +53,7 @@ all-types = [ "bigdecimal", "json", "time", "chrono", "ipnetwork", "uuid" ]
# runtime
runtime-async-std = [ "sqlx-core/runtime-async-std", "sqlx-macros/runtime-async-std" ]
runtime-actix = [ "sqlx-core/runtime-actix", "sqlx-macros/runtime-actix" ]
runtime-tokio = [ "sqlx-core/runtime-tokio", "sqlx-macros/runtime-tokio" ]
# database

View File

@ -15,10 +15,6 @@ authors = [
[features]
default = [ "runtime-async-std" ]
# [deprecated] TLS is not possible to disable due to it being conditional on multiple features
# Hopefully Cargo can handle this in the future
tls = []
# databases
postgres = [ "md-5", "sha2", "base64", "sha-1", "rand", "hmac", "futures-channel/sink", "futures-util/sink" ]
mysql = [ "sha-1", "sha2", "generic-array", "num-bigint", "base64", "digest", "rand" ]

View File

@ -18,8 +18,10 @@ proc-macro = true
[features]
default = [ "runtime-async-std" ]
# runtimes
runtime-async-std = [ "sqlx-core/runtime-async-std", "async-std" ]
runtime-tokio = [ "sqlx-core/runtime-tokio", "tokio", "once_cell" ]
runtime-actix = [ "sqlx-core/runtime-actix", "tokio", "once_cell" ]
# offline building support
offline = ["sqlx-core/offline", "serde", "serde_json", "hex", "sha2"]

View File

@ -1,13 +1,9 @@
#[cfg(not(any(feature = "runtime-tokio", feature = "runtime-async-std")))]
compile_error!("one of 'runtime-async-std' or 'runtime-tokio' features must be enabled");
#[cfg(all(feature = "runtime-tokio", feature = "runtime-async-std"))]
compile_error!("only one of 'runtime-async-std' or 'runtime-tokio' features must be enabled");
// NOTE: this is separate from sqlx-rt because of the non-production nature of it
#[cfg(feature = "runtime-async-std")]
pub(crate) use async_std::task::block_on;
#[cfg(feature = "runtime-tokio")]
#[cfg(any(feature = "runtime-tokio", feature = "runtime-actix"))]
pub fn block_on<F: std::future::Future>(future: F) -> F::Output {
use once_cell::sync::Lazy;
use tokio::runtime::{self, Runtime};