File tree Expand file tree Collapse file tree 13 files changed +45
-58
lines changed Expand file tree Collapse file tree 13 files changed +45
-58
lines changed Original file line number Diff line number Diff line change 1
1
use std:: future:: Future ;
2
2
3
+ use cfg_if:: cfg_if;
4
+
3
5
use crate :: io;
4
6
use crate :: path:: Path ;
5
7
use crate :: task:: blocking;
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ extension_trait! {
29
29
30
30
[`Waker`]: ../task/struct.Waker.html
31
31
"# ]
32
- pub trait Future [ FutureExt : std :: future :: Future ] {
32
+ pub trait Future {
33
33
#[ doc = r#"
34
34
The type of value produced on completion.
35
35
"# ]
@@ -101,4 +101,7 @@ extension_trait! {
101
101
"# ]
102
102
fn poll( self : Pin <& mut Self >, cx: & mut Context ) -> Poll <Self :: Output >;
103
103
}
104
+
105
+ pub trait FutureExt : std:: future:: Future {
106
+ }
104
107
}
Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ extension_trait! {
44
44
https://docs.rs/futures-preview/0.3.0-alpha.17/futures/io/trait.AsyncBufRead.html
45
45
[provided methods]: #provided-methods
46
46
"# ]
47
- pub trait BufRead [ BufReadExt : futures_io :: AsyncBufRead ] {
47
+ pub trait BufRead {
48
48
#[ doc = r#"
49
49
Returns the contents of the internal buffer, filling it with more data from the
50
50
inner reader if it is empty.
@@ -67,7 +67,9 @@ extension_trait! {
67
67
should no longer be returned in calls to `read`.
68
68
"# ]
69
69
fn consume( self : Pin <& mut Self >, amt: usize ) ;
70
+ }
70
71
72
+ pub trait BufReadExt : futures_io:: AsyncBufRead {
71
73
#[ doc = r#"
72
74
Reads all bytes into `buf` until the delimiter `byte` or EOF is reached.
73
75
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ extension_trait! {
50
50
[`poll_read`]: #tymethod.poll_read
51
51
[`poll_read_vectored`]: #method.poll_read_vectored
52
52
"# ]
53
- pub trait Read [ ReadExt : futures_io :: AsyncRead ] {
53
+ pub trait Read {
54
54
#[ doc = r#"
55
55
Attempt to read from the `AsyncRead` into `buf`.
56
56
"# ]
@@ -70,7 +70,9 @@ extension_trait! {
70
70
) -> Poll <io:: Result <usize >> {
71
71
unreachable!( "this impl only appears in the rendered docs" )
72
72
}
73
+ }
73
74
75
+ pub trait ReadExt : futures_io:: AsyncRead {
74
76
#[ doc = r#"
75
77
Reads some bytes from the byte stream.
76
78
Original file line number Diff line number Diff line change @@ -33,7 +33,7 @@ extension_trait! {
33
33
https://docs.rs/futures-preview/0.3.0-alpha.17/futures/io/trait.AsyncSeek.html
34
34
[provided methods]: #provided-methods
35
35
"# ]
36
- pub trait Seek [ SeekExt : futures_io :: AsyncSeek ] {
36
+ pub trait Seek {
37
37
#[ doc = r#"
38
38
Attempt to seek to an offset, in bytes, in a stream.
39
39
"# ]
@@ -42,7 +42,9 @@ extension_trait! {
42
42
cx: & mut Context <' _>,
43
43
pos: SeekFrom ,
44
44
) -> Poll <io:: Result <u64 >>;
45
+ }
45
46
47
+ pub trait SeekExt : futures_io:: AsyncSeek {
46
48
#[ doc = r#"
47
49
Seeks to a new position in a byte stream.
48
50
@@ -70,7 +72,7 @@ extension_trait! {
70
72
fn seek(
71
73
& mut self ,
72
74
pos: SeekFrom ,
73
- ) -> impl Future <Output = io:: Result <u64 >> [ SeekFuture <' _, Self >]
75
+ ) -> impl Future <Output = io:: Result <u64 >> + ' _ [ SeekFuture <' _, Self >]
74
76
where
75
77
Self : Unpin ,
76
78
{
Original file line number Diff line number Diff line change @@ -49,7 +49,7 @@ extension_trait! {
49
49
[`poll_flush`]: #tymethod.poll_flush
50
50
[`poll_close`]: #tymethod.poll_close
51
51
"# ]
52
- pub trait Write [ WriteExt : futures_io :: AsyncWrite ] {
52
+ pub trait Write {
53
53
#[ doc = r#"
54
54
Attempt to write bytes from `buf` into the object.
55
55
"# ]
@@ -80,7 +80,9 @@ extension_trait! {
80
80
Attempt to close the object.
81
81
"# ]
82
82
fn poll_close( self : Pin <& mut Self >, cx: & mut Context <' _>) -> Poll <io:: Result <( ) >>;
83
+ }
83
84
85
+ pub trait WriteExt : futures_io:: AsyncWrite {
84
86
#[ doc = r#"
85
87
Writes some bytes into the byte stream.
86
88
Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ cfg_if! {
95
95
96
96
use std:: pin:: Pin ;
97
97
98
- use std :: future:: Future ;
98
+ use crate :: future:: Future ;
99
99
use crate :: stream:: FromStream ;
100
100
101
101
pub use merge:: Merge ;
@@ -122,7 +122,7 @@ extension_trait! {
122
122
https://docs.rs/futures-preview/0.3.0-alpha.17/futures/stream/trait.Stream.html
123
123
[provided methods]: #provided-methods
124
124
"# ]
125
- pub trait Stream [ StreamExt : futures_core :: stream :: Stream ] {
125
+ pub trait Stream {
126
126
#[ doc = r#"
127
127
The type of items yielded by this stream.
128
128
"# ]
@@ -180,7 +180,9 @@ extension_trait! {
180
180
```
181
181
"# ]
182
182
fn poll_next( self : Pin <& mut Self >, cx: & mut Context <' _>) -> Poll <Option <Self :: Item >>;
183
+ }
183
184
185
+ pub trait StreamExt : futures_core:: stream:: Stream {
184
186
#[ doc = r#"
185
187
Advances the stream and returns the next value.
186
188
Original file line number Diff line number Diff line change 1
1
//! A thread pool for running blocking functions asynchronously.
2
2
3
- use std:: future:: Future ;
4
3
use std:: sync:: atomic:: { AtomicU64 , Ordering } ;
5
4
use std:: thread;
6
5
use std:: time:: Duration ;
7
6
8
7
use crossbeam_channel:: { bounded, Receiver , Sender } ;
9
8
use lazy_static:: lazy_static;
10
9
10
+ use crate :: future:: Future ;
11
11
use crate :: task:: task:: { JoinHandle , Tag } ;
12
12
use crate :: utils:: abort_on_panic;
13
13
Original file line number Diff line number Diff line change @@ -86,7 +86,7 @@ cfg_if::cfg_if! {
86
86
#[ inline]
87
87
pub fn blocking < F , R > ( future : F ) -> task:: JoinHandle < R >
88
88
where
89
- F : std :: future:: Future < Output = R > + Send + ' static ,
89
+ F : crate :: future:: Future < Output = R > + Send + ' static ,
90
90
R : Send + ' static ,
91
91
{
92
92
blocking:: spawn ( future)
Original file line number Diff line number Diff line change 1
- use std:: future:: Future ;
2
1
use std:: iter;
3
2
use std:: thread;
4
3
@@ -11,6 +10,7 @@ use super::task;
11
10
use super :: task_local;
12
11
use super :: worker;
13
12
use super :: { Builder , JoinHandle } ;
13
+ use crate :: future:: Future ;
14
14
use crate :: utils:: abort_on_panic;
15
15
16
16
/// Spawns a task.
You can’t perform that action at this time.
0 commit comments