From a3053119fafdc055bf1f51ef2c4d46e0e01bbbce Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Mon, 1 Jun 2020 05:34:52 -0700 Subject: [PATCH] fix: expose runtime-actix in sqlx/Cargo.toml --- Cargo.toml | 6 +++++- sqlx-core/Cargo.toml | 4 ---- sqlx-macros/Cargo.toml | 2 ++ sqlx-macros/src/runtime.rs | 8 ++------ 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8759e670..aed501a6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 diff --git a/sqlx-core/Cargo.toml b/sqlx-core/Cargo.toml index 875d6107..aa5346b0 100644 --- a/sqlx-core/Cargo.toml +++ b/sqlx-core/Cargo.toml @@ -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" ] diff --git a/sqlx-macros/Cargo.toml b/sqlx-macros/Cargo.toml index 4137a8fd..dfaf47eb 100644 --- a/sqlx-macros/Cargo.toml +++ b/sqlx-macros/Cargo.toml @@ -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"] diff --git a/sqlx-macros/src/runtime.rs b/sqlx-macros/src/runtime.rs index 2ad420df..f31c634c 100644 --- a/sqlx-macros/src/runtime.rs +++ b/sqlx-macros/src/runtime.rs @@ -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(future: F) -> F::Output { use once_cell::sync::Lazy; use tokio::runtime::{self, Runtime};