core
libcore
gained async capabilities in 1.39Future
types are lazy
let fut = MyFuture::new(data, config); // impl Future for MyFuture { ... }
/// Either of these only work in an async function!
// fut.await;
// futures::poll!(fut);
These can be found in core::future
and core::task
Future
Poll
Waker
Think of a Future as a single step in a chain of async operations.
A task is the chain.
std
!smol-rs
, a very
smol async runtime
Any future can be cancelled at any point!
tokio
[dependencies]
tokio = { version = "1.0", features = ["full"] }
#[tokio::main]
async fn main() {
// your async code here
}
async-std
[dependencies]
async-std = { version = "1.0", features = ["attribute"] }
#[async_std::main]
async fn main() {
// your async code here
}
smol-rs
async-std
!fn main() {
smol::block_on(async {
// your async code here
});
}