2018-09-26 10:10:47 -07:00
|
|
|
#![cfg(feature = "async-await-preview")]
|
2019-02-23 06:30:21 +09:00
|
|
|
#![feature(rust_2018_preview, async_await, await_macro, futures_api)]
|
2019-02-22 17:15:42 -08:00
|
|
|
#![doc(html_root_url = "https://docs.rs/tokio-async-await/0.1.6")]
|
2018-08-27 12:24:51 -07:00
|
|
|
#![deny(missing_docs, missing_debug_implementations)]
|
|
|
|
|
#![cfg_attr(test, deny(warnings))]
|
|
|
|
|
|
|
|
|
|
//! A preview of Tokio w/ `async` / `await` support.
|
|
|
|
|
|
|
|
|
|
extern crate futures;
|
2018-09-26 10:10:47 -07:00
|
|
|
extern crate tokio_io;
|
|
|
|
|
|
|
|
|
|
/// Extracts the successful type of a `Poll<Result<T, E>>`.
|
|
|
|
|
///
|
|
|
|
|
/// This macro bakes in propagation of `Pending` and `Err` signals by returning early.
|
|
|
|
|
macro_rules! try_ready {
|
|
|
|
|
($x:expr) => {
|
|
|
|
|
match $x {
|
|
|
|
|
std::task::Poll::Ready(Ok(x)) => x,
|
2019-02-21 11:56:15 -08:00
|
|
|
std::task::Poll::Ready(Err(e)) => return std::task::Poll::Ready(Err(e.into())),
|
|
|
|
|
std::task::Poll::Pending => return std::task::Poll::Pending,
|
2018-09-26 10:10:47 -07:00
|
|
|
}
|
2019-02-21 11:56:15 -08:00
|
|
|
};
|
2018-08-27 12:24:51 -07:00
|
|
|
}
|
|
|
|
|
|
2018-09-26 10:10:47 -07:00
|
|
|
#[macro_use]
|
|
|
|
|
mod await;
|
|
|
|
|
pub mod compat;
|
|
|
|
|
pub mod io;
|
|
|
|
|
pub mod sink;
|
|
|
|
|
pub mod stream;
|
2018-08-27 12:24:51 -07:00
|
|
|
|
2018-09-26 10:10:47 -07:00
|
|
|
// Rename the `await` macro in `std`. This is used by the redefined
|
|
|
|
|
// `await` macro in this crate.
|
2018-08-27 12:24:51 -07:00
|
|
|
#[doc(hidden)]
|
|
|
|
|
pub use std::await as std_await;
|