2
0
Fork 1
mirror of https://github.com/async-rs/async-std.git synced 2025-01-31 17:55:35 +00:00
async-std/src/prelude.rs

45 lines
1 KiB
Rust
Raw Normal View History

2019-08-08 12:44:48 +00:00
//! The async prelude.
//!
//! The prelude re-exports the most commonly used traits in async programming.
//!
//! # Examples
//!
//! Import the prelude to use the [`timeout`] combinator:
//!
//! ```no_run
//! # #![feature(async_await)]
2019-08-09 00:56:59 +00:00
//! # fn main() -> std::io::Result<()> { async_std::task::block_on(async {
//! #
2019-08-08 12:44:48 +00:00
//! use std::time::Duration;
//!
2019-08-14 13:57:51 +00:00
//! use async_std::io;
//! use async_std::prelude::*;
//!
2019-08-08 12:44:48 +00:00
//! let stdin = io::stdin();
//! let mut line = String::new();
//! let dur = Duration::from_secs(5);
//!
//! stdin.read_line(&mut line).timeout(dur).await??;
2019-08-09 00:56:59 +00:00
//! #
//! # Ok(()) }) }
2019-08-08 12:44:48 +00:00
//! ```
//!
//! [`timeout`]: ../time/trait.Timeout.html#method.timeout
#[doc(no_inline)]
2019-08-12 10:43:44 +00:00
pub use crate::future::Future;
2019-08-08 12:44:48 +00:00
#[doc(no_inline)]
2019-08-12 10:43:44 +00:00
pub use crate::io::BufRead as _;
2019-08-08 12:44:48 +00:00
#[doc(no_inline)]
2019-08-12 10:43:44 +00:00
pub use crate::io::Read as _;
2019-08-08 12:44:48 +00:00
#[doc(no_inline)]
2019-08-12 10:43:44 +00:00
pub use crate::io::Seek as _;
2019-08-08 12:44:48 +00:00
#[doc(no_inline)]
2019-08-12 10:43:44 +00:00
pub use crate::io::Write as _;
2019-08-08 12:44:48 +00:00
#[doc(no_inline)]
2019-08-12 10:43:44 +00:00
pub use crate::stream::Stream;
2019-08-08 12:44:48 +00:00
#[doc(no_inline)]
2019-08-14 01:47:39 +00:00
pub use crate::task_local;
#[doc(no_inline)]
2019-08-08 12:44:48 +00:00
pub use crate::time::Timeout as _;