mirror of
https://github.com/launchbadge/sqlx.git
synced 2026-03-23 18:40:24 +00:00
Upgrade async runtime dependencies
Co-authored-by: Josh Toft <joshtoft@gmail.com> Co-authored-by: Philip A Reimer <antreimer@gmail.com>
This commit is contained in:
committed by
Ryan Leckey
parent
2a80700813
commit
cdafc8ae17
@@ -28,12 +28,12 @@ _tls-rustls = [ ]
|
||||
|
||||
[dependencies]
|
||||
async-native-tls = { version = "0.3.3", optional = true }
|
||||
async-rustls = { version = "0.1.0", optional = true }
|
||||
actix-rt = { version = "1.1.1", optional = true }
|
||||
async-rustls = { version = "0.2.0", optional = true }
|
||||
actix-rt = { version = "=2.0.0-beta.1", optional = true }
|
||||
actix-threadpool = { version = "0.3.2", optional = true }
|
||||
async-std = { version = "1.6.5", 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 }
|
||||
tokio-rustls = { version = "0.14.0", optional = true }
|
||||
async-std = { version = "1.7.0", features = [ "unstable" ], optional = true }
|
||||
tokio = { version = "1.0.1", optional = true, features = [ "fs", "net", "macros", "rt", "rt-multi-thread", "time", "io-util" ] }
|
||||
tokio-native-tls = { version = "0.3.0", optional = true }
|
||||
tokio-rustls = { version = "0.22.0", optional = true }
|
||||
native-tls = { version = "0.2.4", optional = true }
|
||||
once_cell = { version = "1.4", features = ["std"], optional = true }
|
||||
|
||||
@@ -36,8 +36,8 @@ pub use native_tls;
|
||||
not(feature = "_rt-async-std"),
|
||||
))]
|
||||
pub use tokio::{
|
||||
self, fs, io::AsyncRead, io::AsyncReadExt, io::AsyncWrite, io::AsyncWriteExt, net::TcpStream,
|
||||
task::spawn, task::yield_now, time::delay_for as sleep, time::timeout,
|
||||
self, fs, io::AsyncRead, io::AsyncReadExt, io::AsyncWrite, io::AsyncWriteExt, io::ReadBuf,
|
||||
net::TcpStream, task::spawn, task::yield_now, time::sleep, time::timeout,
|
||||
};
|
||||
|
||||
#[cfg(all(
|
||||
@@ -60,9 +60,7 @@ mod tokio_runtime {
|
||||
|
||||
// lazily initialize a global runtime once for multiple invocations of the macros
|
||||
static RUNTIME: Lazy<Runtime> = Lazy::new(|| {
|
||||
runtime::Builder::new()
|
||||
// `.basic_scheduler()` requires calling `Runtime::block_on()` which needs mutability
|
||||
.threaded_scheduler()
|
||||
runtime::Builder::new_multi_thread()
|
||||
.enable_io()
|
||||
.enable_time()
|
||||
.build()
|
||||
@@ -70,14 +68,15 @@ mod tokio_runtime {
|
||||
});
|
||||
|
||||
pub fn block_on<F: std::future::Future>(future: F) -> F::Output {
|
||||
RUNTIME.enter(|| RUNTIME.handle().block_on(future))
|
||||
RUNTIME.block_on(future)
|
||||
}
|
||||
|
||||
pub fn enter_runtime<F, R>(f: F) -> R
|
||||
where
|
||||
F: FnOnce() -> R,
|
||||
{
|
||||
RUNTIME.enter(f)
|
||||
RUNTIME.enter();
|
||||
f()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user