ferron_common/
runtime.rs

1use std::future::Future;
2
3/// Spawn a future in an asynchronous runtime
4#[cfg(feature = "runtime-monoio")]
5pub fn spawn(future: impl Future + 'static) {
6  monoio::spawn(future);
7}
8
9/// Spawn a future in an asynchronous runtime
10#[cfg(feature = "runtime-tokio")]
11pub fn spawn(future: impl Future + 'static) {
12  tokio::task::spawn_local(future);
13}
14
15/// Spawn a future in an asynchronous runtime
16#[cfg(feature = "runtime-vibeio")]
17pub fn spawn(future: impl Future + 'static) {
18  vibeio::spawn(future);
19}
20
21#[cfg(feature = "runtime-monoio")]
22pub use monoio::spawn_blocking;
23#[cfg(feature = "runtime-tokio")]
24pub use tokio::task::spawn_blocking;
25#[cfg(feature = "runtime-vibeio")]
26pub use vibeio::spawn_blocking;
27
28#[cfg(feature = "runtime-monoio")]
29pub use monoio::time::sleep;
30#[cfg(feature = "runtime-tokio")]
31pub use tokio::time::sleep;
32#[cfg(feature = "runtime-vibeio")]
33pub use vibeio::time::sleep;
34
35#[cfg(feature = "runtime-monoio")]
36pub use monoio::time::timeout;
37#[cfg(feature = "runtime-tokio")]
38pub use tokio::time::timeout;
39#[cfg(feature = "runtime-vibeio")]
40pub use vibeio::time::timeout;
41
42#[cfg(feature = "runtime-monoio")]
43pub use monoio::select;
44#[cfg(feature = "runtime-vibeio")]
45pub use tokio::select;
46#[cfg(feature = "runtime-tokio")]
47pub use tokio::select;