File tree Expand file tree Collapse file tree 12 files changed +94
-44
lines changed Expand file tree Collapse file tree 12 files changed +94
-44
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,14 @@ extension_trait! {
2323 "asynchronous value" makes it possible for a thread to continue doing useful
2424 work while it waits for the value to become available.
2525
26+ The [provided methods] do not really exist in the trait itself, but they become
27+ available when [`FutureExt`] from the [prelude] is imported:
28+
29+ ```
30+ # #[allow(unused_imports)]
31+ use async_std::prelude::*;
32+ ```
33+
2634 # The `poll` method
2735
2836 The core method of future, `poll`, *attempts* to resolve the future into a
@@ -36,6 +44,9 @@ extension_trait! {
3644 `.await` the value.
3745
3846 [`Waker`]: ../task/struct.Waker.html
47+ [provided methods]: #provided-methods
48+ [`FutureExt`]: ../prelude/trait.FutureExt.html
49+ [prelude]: ../prelude/index.html
3950 "# ]
4051 pub trait Future {
4152 #[ doc = r#"
@@ -110,6 +121,11 @@ extension_trait! {
110121 fn poll( self : Pin <& mut Self >, cx: & mut Context ) -> Poll <Self :: Output >;
111122 }
112123
124+ #[ doc = r#"
125+ Extension methods for [`Future`].
126+
127+ [`Future`]: ../future/trait.Future.html
128+ "# ]
113129 pub trait FutureExt : std:: future:: Future {
114130 /// Returns a Future that delays execution for a specified time.
115131 ///
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ extension_trait! {
2525 [`std::io::BufRead`].
2626
2727 The [provided methods] do not really exist in the trait itself, but they become
28- available when the prelude is imported:
28+ available when [`BufReadExt`] from the [ prelude] is imported:
2929
3030 ```
3131 # #[allow(unused_imports)]
@@ -36,6 +36,8 @@ extension_trait! {
3636 [`futures::io::AsyncBufRead`]:
3737 https://docs.rs/futures-preview/0.3.0-alpha.17/futures/io/trait.AsyncBufRead.html
3838 [provided methods]: #provided-methods
39+ [`BufReadExt`]: ../io/prelude/trait.BufReadExt.html
40+ [prelude]: ../prelude/index.html
3941 "# ]
4042 pub trait BufRead {
4143 #[ doc = r#"
@@ -62,6 +64,11 @@ extension_trait! {
6264 fn consume( self : Pin <& mut Self >, amt: usize ) ;
6365 }
6466
67+ #[ doc = r#"
68+ Extension methods for [`BufRead`].
69+
70+ [`BufRead`]: ../trait.BufRead.html
71+ "# ]
6572 pub trait BufReadExt : futures_io:: AsyncBufRead {
6673 #[ doc = r#"
6774 Reads all bytes into `buf` until the delimiter `byte` or EOF is reached.
Original file line number Diff line number Diff line change 1- //! The async I/O Prelude
1+ //! The async I/O prelude.
22//!
33//! The purpose of this module is to alleviate imports of many common I/O traits
44//! by adding a glob import to the top of I/O heavy modules:
@@ -17,11 +17,11 @@ pub use crate::io::Seek;
1717#[ doc( no_inline) ]
1818pub use crate :: io:: Write ;
1919
20- #[ doc( hidden ) ]
21- pub use crate :: io:: buf_read:: BufReadExt as _ ;
22- #[ doc( hidden ) ]
23- pub use crate :: io:: read:: ReadExt as _ ;
24- #[ doc( hidden ) ]
25- pub use crate :: io:: seek:: SeekExt as _ ;
26- #[ doc( hidden ) ]
27- pub use crate :: io:: write:: WriteExt as _ ;
20+ #[ doc( inline ) ]
21+ pub use crate :: io:: buf_read:: BufReadExt ;
22+ #[ doc( inline ) ]
23+ pub use crate :: io:: read:: ReadExt ;
24+ #[ doc( inline ) ]
25+ pub use crate :: io:: seek:: SeekExt ;
26+ #[ doc( inline ) ]
27+ pub use crate :: io:: write:: WriteExt ;
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ extension_trait! {
3131 [`std::io::Read`].
3232
3333 Methods other than [`poll_read`] and [`poll_read_vectored`] do not really exist in the
34- trait itself, but they become available when the prelude is imported:
34+ trait itself, but they become available when [`ReadExt`] from the [ prelude] is imported:
3535
3636 ```
3737 # #[allow(unused_imports)]
@@ -43,6 +43,8 @@ extension_trait! {
4343 https://docs.rs/futures-preview/0.3.0-alpha.17/futures/io/trait.AsyncRead.html
4444 [`poll_read`]: #tymethod.poll_read
4545 [`poll_read_vectored`]: #method.poll_read_vectored
46+ [`ReadExt`]: ../io/prelude/trait.ReadExt.html
47+ [prelude]: ../prelude/index.html
4648 "# ]
4749 pub trait Read {
4850 #[ doc = r#"
@@ -66,6 +68,11 @@ extension_trait! {
6668 }
6769 }
6870
71+ #[ doc = r#"
72+ Extension methods for [`Read`].
73+
74+ [`Read`]: ../trait.Read.html
75+ "# ]
6976 pub trait ReadExt : futures_io:: AsyncRead {
7077 #[ doc = r#"
7178 Reads some bytes from the byte stream.
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ extension_trait! {
1818 [`std::io::Seek`].
1919
2020 The [provided methods] do not really exist in the trait itself, but they become
21- available when the prelude is imported:
21+ available when [`SeekExt`] the [ prelude] is imported:
2222
2323 ```
2424 # #[allow(unused_imports)]
@@ -29,6 +29,8 @@ extension_trait! {
2929 [`futures::io::AsyncSeek`]:
3030 https://docs.rs/futures-preview/0.3.0-alpha.17/futures/io/trait.AsyncSeek.html
3131 [provided methods]: #provided-methods
32+ [`SeekExt`]: ../io/prelude/trait.SeekExt.html
33+ [prelude]: ../prelude/index.html
3234 "# ]
3335 pub trait Seek {
3436 #[ doc = r#"
@@ -41,6 +43,11 @@ extension_trait! {
4143 ) -> Poll <io:: Result <u64 >>;
4244 }
4345
46+ #[ doc = r#"
47+ Extension methods for [`Seek`].
48+
49+ [`Seek`]: ../trait.Seek.html
50+ "# ]
4451 pub trait SeekExt : futures_io:: AsyncSeek {
4552 #[ doc = r#"
4653 Seeks to a new position in a byte stream.
Original file line number Diff line number Diff line change @@ -173,7 +173,7 @@ impl Stdin {
173173 /// # fn main() -> std::io::Result<()> { async_std::task::block_on(async {
174174 /// #
175175 /// use async_std::io;
176- /// use crate:: async_std::prelude::*;
176+ /// use async_std::prelude::*;
177177 ///
178178 /// let mut buffer = String::new();
179179 ///
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ extension_trait! {
2626
2727 Methods other than [`poll_write`], [`poll_write_vectored`], [`poll_flush`], and
2828 [`poll_close`] do not really exist in the trait itself, but they become available when
29- the prelude is imported:
29+ [`WriteExt`] from the [ prelude] is imported:
3030
3131 ```
3232 # #[allow(unused_imports)]
@@ -40,6 +40,8 @@ extension_trait! {
4040 [`poll_write_vectored`]: #method.poll_write_vectored
4141 [`poll_flush`]: #tymethod.poll_flush
4242 [`poll_close`]: #tymethod.poll_close
43+ [`WriteExt`]: ../io/prelude/trait.WriteExt.html
44+ [prelude]: ../prelude/index.html
4345 "# ]
4446 pub trait Write {
4547 #[ doc = r#"
@@ -74,6 +76,11 @@ extension_trait! {
7476 fn poll_close( self : Pin <& mut Self >, cx: & mut Context <' _>) -> Poll <io:: Result <( ) >>;
7577 }
7678
79+ #[ doc = r#"
80+ Extension methods for [`Write`].
81+
82+ [`Write`]: ../trait.Write.html
83+ "# ]
7784 pub trait WriteExt : futures_io:: AsyncWrite {
7885 #[ doc = r#"
7986 Writes some bytes into the byte stream.
Original file line number Diff line number Diff line change 1313
1414#[ doc( no_inline) ]
1515pub use crate :: future:: Future ;
16+ #[ doc( no_inline) ]
17+ pub use crate :: stream:: Stream ;
18+ #[ doc( no_inline) ]
19+ pub use crate :: task_local;
20+
21+ #[ doc( inline) ]
22+ pub use crate :: future:: future:: FutureExt ;
23+ #[ doc( inline) ]
24+ pub use crate :: stream:: stream:: StreamExt ;
25+
1626#[ doc( no_inline) ]
1727pub use crate :: io:: BufRead as _;
1828#[ doc( no_inline) ]
@@ -21,23 +31,15 @@ pub use crate::io::Read as _;
2131pub use crate :: io:: Seek as _;
2232#[ doc( no_inline) ]
2333pub use crate :: io:: Write as _;
34+
2435#[ doc( no_inline) ]
25- pub use crate :: stream :: Stream ;
36+ pub use crate :: io :: prelude :: BufReadExt as _ ;
2637#[ doc( no_inline) ]
27- pub use crate :: task_local;
28-
29- #[ doc( hidden) ]
30- pub use crate :: future:: future:: FutureExt as _;
31- #[ doc( hidden) ]
32- pub use crate :: io:: buf_read:: BufReadExt as _;
33- #[ doc( hidden) ]
34- pub use crate :: io:: read:: ReadExt as _;
35- #[ doc( hidden) ]
36- pub use crate :: io:: seek:: SeekExt as _;
37- #[ doc( hidden) ]
38- pub use crate :: io:: write:: WriteExt as _;
39- #[ doc( hidden) ]
40- pub use crate :: stream:: stream:: StreamExt as _;
38+ pub use crate :: io:: prelude:: ReadExt as _;
39+ #[ doc( no_inline) ]
40+ pub use crate :: io:: prelude:: SeekExt as _;
41+ #[ doc( no_inline) ]
42+ pub use crate :: io:: prelude:: WriteExt as _;
4143
4244cfg_unstable ! {
4345 #[ doc( no_inline) ]
Original file line number Diff line number Diff line change @@ -15,9 +15,8 @@ use std::pin::Pin;
1515///
1616/// ```
1717/// # fn main() -> std::io::Result<()> { async_std::task::block_on(async {
18- /// use crate::async_std::stream::FromStream;
1918/// use async_std::prelude::*;
20- /// use async_std::stream;
19+ /// use async_std::stream::{self, FromStream} ;
2120///
2221/// let five_fives = stream::repeat(5).take(5);
2322///
@@ -117,9 +116,8 @@ pub trait FromStream<T> {
117116 ///
118117 /// ```
119118 /// # fn main() -> std::io::Result<()> { async_std::task::block_on(async {
120- /// use crate::async_std::stream::FromStream;
121119 /// use async_std::prelude::*;
122- /// use async_std::stream;
120+ /// use async_std::stream::{self, FromStream} ;
123121 ///
124122 /// let five_fives = stream::repeat(5).take(5);
125123 ///
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ extension_trait! {
138138 [`std::iter::Iterator`].
139139
140140 The [provided methods] do not really exist in the trait itself, but they become
141- available when the prelude is imported:
141+ available when [`StreamExt`] from the [ prelude] is imported:
142142
143143 ```
144144 # #[allow(unused_imports)]
@@ -149,6 +149,8 @@ extension_trait! {
149149 [`futures::stream::Stream`]:
150150 https://docs.rs/futures-preview/0.3.0-alpha.17/futures/stream/trait.Stream.html
151151 [provided methods]: #provided-methods
152+ [`StreamExt`]: ../prelude/trait.StreamExt.html
153+ [prelude]: ../prelude/index.html
152154 "# ]
153155 pub trait Stream {
154156 #[ doc = r#"
@@ -210,6 +212,11 @@ extension_trait! {
210212 fn poll_next( self : Pin <& mut Self >, cx: & mut Context <' _>) -> Poll <Option <Self :: Item >>;
211213 }
212214
215+ #[ doc = r#"
216+ Extension methods for [`Stream`].
217+
218+ [`Stream`]: ../stream/trait.Stream.html
219+ "# ]
213220 pub trait StreamExt : futures_core:: stream:: Stream {
214221 #[ doc = r#"
215222 Advances the stream and returns the next value.
You can’t perform that action at this time.
0 commit comments