hopr_async_runtime/
lib.rs1pub use futures::future::AbortHandle;
5
6#[cfg(feature = "runtime-tokio")]
9pub mod prelude {
10 pub use futures::future::{AbortHandle, abortable};
11 pub use tokio::{
12 task::{JoinHandle, spawn, spawn_blocking, spawn_local},
13 time::{sleep, timeout as timeout_fut},
14 };
15}
16
17#[macro_export]
18macro_rules! spawn_as_abortable {
19 ($($expr:expr),*) => {{
20 let (proc, abort_handle) = $crate::prelude::abortable($($expr),*);
21 let _jh = $crate::prelude::spawn(proc);
22 abort_handle
23 }}
24}
25
26#[cfg(not(feature = "runtime-tokio"))]
28compile_error!("No runtime enabled");