forked from mirror/async-std
Merge #160
160: add io::prelude r=stjepang a=yoshuawuyts I was working on some async io code earlier, and ended up writing: ```rust use async_std::io::{BufReader, BufRead, Read}; ``` It took a bit of trial and error to get the right traits in scope, and I kind of wished I had `io::prelude` available so it would *just work*. Which is why this patch adds `io::prelude`. I guess I'm kind of circling back on the idea of only having a single prelude; but overall I think this feels more intuitive. Thanks! ## Screenshots ![Screenshot_2019-09-08 async_std io - Rust](https://user-images.githubusercontent.com/2467194/64481454-8e2f8500-d1dc-11e9-9299-7a82b7dbb031.png) ![Screenshot_2019-09-08 async_std io prelude - Rust](https://user-images.githubusercontent.com/2467194/64481455-8e2f8500-d1dc-11e9-9d20-1e90fabccaf4.png) ![Screenshot_2019-09-08 std io prelude - Rust](https://user-images.githubusercontent.com/2467194/64481509-bfa85080-d1dc-11e9-9965-be7d0d84b551.png) Co-authored-by: Yoshua Wuyts <yoshuawuyts@gmail.com>staging
commit
cc9e078d1b
@ -0,0 +1,18 @@
|
||||
//! The async I/O Prelude
|
||||
//!
|
||||
//! The purpose of this module is to alleviate imports of many common I/O traits
|
||||
//! by adding a glob import to the top of I/O heavy modules:
|
||||
//!
|
||||
//! ```
|
||||
//! # #![allow(unused_imports)]
|
||||
//! use async_std::io::prelude::*;
|
||||
//! ```
|
||||
|
||||
#[doc(no_inline)]
|
||||
pub use super::BufRead as _;
|
||||
#[doc(no_inline)]
|
||||
pub use super::Read as _;
|
||||
#[doc(no_inline)]
|
||||
pub use super::Seek as _;
|
||||
#[doc(no_inline)]
|
||||
pub use super::Write as _;
|
Loading…
Reference in New Issue