Switch branches/tags
Find file History
andoks and carllerche Fix async await README example (#758)
* async-await: fix README example dependencies

As per commit "async-await: track nightly changes (#661)" ( commit
2f690d3)

> The `tokio-async-await` crate is no longer a facade. Instead, the
> `tokio` crate provides a feature flag to enable async/await support.

Ensure the example in the async-await README file also works by
correctly declaring this updated dependency

* async-await: remove unnecessary 'edition' declaration from README

As the "edition" feature was stabilized in rust v1.30 and async-await
specifies that the nightly toolchain must be used, remove the use of the
"edition" feature gate since it is enabled by default.
Latest commit 42a0df1 Nov 17, 2018
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
examples async-await: track nightly changes (#661) Sep 26, 2018
src Bump version to v0.1.9 (#666) Sep 27, 2018
Cargo.toml Bump version to v0.1.9 (#666) Sep 27, 2018
LICENSE add experimental async/await support. (#582) Aug 27, 2018
README.md Fix async await README example (#758) Nov 18, 2018

README.md

Tokio async/await preview

This crate provides a preview of Tokio with async / await support. It is a shim layer on top of tokio.

This crate requires Rust nightly and does not provide API stability guarantees. You are living on the edge here.

Usage

To use this crate, you need to start with a Rust 2018 edition crate.

Add this to your Cargo.toml:

# In the `[packages]` section
edition = "2018"

# In the `[dependencies]` section
tokio = {version = "0.1.0", features = ["async-await-preview"]}

Then, get started. In your application, add:

// The nightly features that are commonly needed with async / await
#![feature(await_macro, async_await, futures_api)]

// This pulls in the `tokio-async-await` crate. While Rust 2018 doesn't require
// `extern crate`, we need to pull in the macros.
#[macro_use]
extern crate tokio;

fn main() {
    // And we are async...
    tokio::run_async(async {
        println!("Hello");
    });
}

Because nightly is required, run the app with cargo +nightly run

Check the examples directory for more.

License

This project is licensed under the MIT license.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in Tokio by you, shall be licensed as MIT, without any additional terms or conditions.