1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#![doc(html_root_url = "https://docs.rs/heim-runtime/0.1.0-rc.1")]
#![deny(
    unused,
    unused_imports,
    unused_features,
    unsafe_code,
    bare_trait_objects,
    future_incompatible,
    missing_debug_implementations,
//    missing_docs, // TODO
    nonstandard_style,
    dead_code,
    deprecated,
    broken_intra_doc_links,
)]
#![warn(
    trivial_casts,
    trivial_numeric_casts,
    unused_extern_crates,
    unused_import_braces,
    unused_results
)]

use std::future::Future;

pub use futures::pin_mut as pin;

pub mod fs;
#[cfg(target_os = "linux")]
pub mod linux;
pub mod time;

#[inline]
pub async fn spawn<F, R>(f: F) -> R
where
    F: Future<Output = R> + Send + 'static,
    R: Send + 'static,
{
    smol::spawn(f).await
}

pub async fn spawn_blocking<F, R>(f: F) -> R
where
    F: FnOnce() -> R + Send + 'static,
    R: Send + 'static,
{
    smol::unblock(f).await
}