docs and tests work

This commit is contained in:
Christien Rioux
2023-08-29 15:15:47 -05:00
parent d3407998f5
commit e302b764d0
27 changed files with 156 additions and 74 deletions

View File

@@ -41,17 +41,21 @@ pub async fn run_all_tests() {
info!("Finished unit tests");
}
#[allow(dead_code)]
#[cfg(feature = "rt-tokio")]
pub fn block_on<F: Future<Output = T>, T>(f: F) -> T {
let rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(f)
}
#[cfg(feature = "rt-async-std")]
#[allow(dead_code)]
pub fn block_on<F: Future<Output = T>, T>(f: F) -> T {
async_std::task::block_on(f)
cfg_if::cfg_if! {
if #[cfg(feature = "rt-async-std")] {
#[allow(dead_code)]
pub fn block_on<F: Future<Output = T>, T>(f: F) -> T {
async_std::task::block_on(f)
}
} else if #[cfg(feature = "rt-tokio")] {
#[allow(dead_code)]
pub fn block_on<F: Future<Output = T>, T>(f: F) -> T {
let rt = tokio::runtime::Runtime::new().unwrap();
rt.block_on(f)
}
} else {
compile_error!("needs executor implementation")
}
}
///////////////////////////////////////////////////////////////////////////