File tree Expand file tree Collapse file tree 14 files changed +45
-60
lines changed Expand file tree Collapse file tree 14 files changed +45
-60
lines changed Original file line number Diff line number Diff line change 1
- use std:: future:: Future ;
2
1
use std:: path:: Path ;
3
2
4
3
use cfg_if:: cfg_if;
5
4
5
+ use crate :: future:: Future ;
6
6
use crate :: io;
7
7
use crate :: task:: blocking;
8
8
Original file line number Diff line number Diff line change 1
- use std:: future:: Future ;
2
1
use std:: path:: Path ;
3
2
4
3
use cfg_if:: cfg_if;
5
4
6
5
use crate :: fs:: File ;
6
+ use crate :: future:: Future ;
7
7
use crate :: io;
8
8
use crate :: task:: blocking;
9
9
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 @@ -41,7 +41,7 @@ extension_trait! {
41
41
https://docs.rs/futures-preview/0.3.0-alpha.17/futures/io/trait.AsyncBufRead.html
42
42
[provided methods]: #provided-methods
43
43
"# ]
44
- pub trait BufRead [ BufReadExt : futures_io :: AsyncBufRead ] {
44
+ pub trait BufRead {
45
45
#[ doc = r#"
46
46
Returns the contents of the internal buffer, filling it with more data from the
47
47
inner reader if it is empty.
@@ -64,7 +64,9 @@ extension_trait! {
64
64
should no longer be returned in calls to `read`.
65
65
"# ]
66
66
fn consume( self : Pin <& mut Self >, amt: usize ) ;
67
+ }
67
68
69
+ pub trait BufReadExt : futures_io:: AsyncBufRead {
68
70
#[ doc = r#"
69
71
Reads all bytes into `buf` until the delimiter `byte` or EOF is reached.
70
72
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 @@ -47,7 +47,7 @@ extension_trait! {
47
47
[`poll_flush`]: #tymethod.poll_flush
48
48
[`poll_close`]: #tymethod.poll_close
49
49
"# ]
50
- pub trait Write [ WriteExt : futures_io :: AsyncWrite ] {
50
+ pub trait Write {
51
51
#[ doc = r#"
52
52
Attempt to write bytes from `buf` into the object.
53
53
"# ]
@@ -78,7 +78,9 @@ extension_trait! {
78
78
Attempt to close the object.
79
79
"# ]
80
80
fn poll_close( self : Pin <& mut Self >, cx: & mut Context <' _>) -> Poll <io:: Result <( ) >>;
81
+ }
81
82
83
+ pub trait WriteExt : futures_io:: AsyncWrite {
82
84
#[ doc = r#"
83
85
Writes some bytes into the byte stream.
84
86
Original file line number Diff line number Diff line change @@ -89,7 +89,7 @@ cfg_if! {
89
89
if #[ cfg( any( feature = "unstable" , feature = "docs" ) ) ] {
90
90
use std:: pin:: Pin ;
91
91
92
- use std :: future:: Future ;
92
+ use crate :: future:: Future ;
93
93
use crate :: stream:: FromStream ;
94
94
}
95
95
}
@@ -114,7 +114,7 @@ extension_trait! {
114
114
https://docs.rs/futures-preview/0.3.0-alpha.17/futures/stream/trait.Stream.html
115
115
[provided methods]: #provided-methods
116
116
"# ]
117
- pub trait Stream [ StreamExt : futures_core :: stream :: Stream ] {
117
+ pub trait Stream {
118
118
#[ doc = r#"
119
119
The type of items yielded by this stream.
120
120
"# ]
@@ -172,7 +172,9 @@ extension_trait! {
172
172
```
173
173
"# ]
174
174
fn poll_next( self : Pin <& mut Self >, cx: & mut Context <' _>) -> Poll <Option <Self :: Item >>;
175
+ }
175
176
177
+ pub trait StreamExt : futures_core:: stream:: Stream {
176
178
#[ doc = r#"
177
179
Advances the stream and returns the next value.
178
180
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 @@ -81,7 +81,7 @@ pub(crate) mod blocking;
81
81
#[ inline]
82
82
pub fn blocking < F , R > ( future : F ) -> task:: JoinHandle < R >
83
83
where
84
- F : std :: future:: Future < Output = R > + Send + ' static ,
84
+ F : crate :: future:: Future < Output = R > + Send + ' static ,
85
85
R : Send + ' static ,
86
86
{
87
87
blocking:: spawn ( future)
You can’t perform that action at this time.
0 commit comments