#[cfg(feature = "redis-tokio")]
pub type Runtime = tokio::runtime::Runtime;
#[cfg(all(feature = "redis-smol", not(feature = "redis-tokio")))]
pub type Runtime = ();
#[cfg(feature = "redis-tokio")]
pub fn build() -> Runtime {
tokio::runtime::Builder::new_multi_thread()
.enable_all()
.worker_threads(2)
.build()
.unwrap()
}
#[cfg(all(feature = "redis-smol", not(feature = "redis-tokio")))]
pub fn build() -> Runtime {}
#[cfg(feature = "redis-tokio")]
pub fn block_on<F, T>(rt: &Runtime, f: F) -> T
where
F: std::future::Future<Output = T>,
{
rt.block_on(f)
}
#[cfg(all(feature = "redis-smol", not(feature = "redis-tokio")))]
pub fn block_on<F, T>(_rt: &Runtime, f: F) -> T
where
F: std::future::Future<Output = T>,
{
smol::block_on(f)
}