1
+ use std:: io;
1
2
use std:: mem;
2
3
use std:: pin:: Pin ;
3
4
use std:: str;
4
5
5
6
use pin_project_lite:: pin_project;
6
7
7
- use async_std :: io :: { self , BufRead } ;
8
- use async_std :: stream :: Stream ;
9
- use async_std :: task:: { ready , Context , Poll } ;
8
+ use futures_lite :: prelude :: * ;
9
+ use futures_lite :: ready ;
10
+ use std :: task:: { Context , Poll } ;
10
11
11
12
pin_project ! {
12
13
/// A stream of lines in a byte stream.
@@ -31,7 +32,7 @@ pin_project! {
31
32
impl < R > Lines < R > {
32
33
pub ( crate ) fn new ( reader : R ) -> Lines < R >
33
34
where
34
- R : BufRead + Unpin + Sized ,
35
+ R : AsyncBufRead + Unpin + Sized ,
35
36
{
36
37
Lines {
37
38
reader,
@@ -42,12 +43,12 @@ impl<R> Lines<R> {
42
43
}
43
44
}
44
45
45
- impl < R : BufRead > Stream for Lines < R > {
46
+ impl < R : AsyncBufRead > Stream for Lines < R > {
46
47
type Item = io:: Result < String > ;
47
48
48
49
fn poll_next ( self : Pin < & mut Self > , cx : & mut Context < ' _ > ) -> Poll < Option < Self :: Item > > {
49
50
let this = self . project ( ) ;
50
- let n = async_std :: task :: ready!( read_line_internal(
51
+ let n = ready ! ( read_line_internal(
51
52
this. reader,
52
53
cx,
53
54
this. buf,
@@ -67,7 +68,7 @@ impl<R: BufRead> Stream for Lines<R> {
67
68
}
68
69
}
69
70
70
- fn read_line_internal < R : BufRead + ?Sized > (
71
+ fn read_line_internal < R : AsyncBufRead + ?Sized > (
71
72
reader : Pin < & mut R > ,
72
73
cx : & mut Context < ' _ > ,
73
74
buf : & mut String ,
@@ -91,7 +92,7 @@ fn read_line_internal<R: BufRead + ?Sized>(
91
92
}
92
93
}
93
94
94
- fn read_until_internal < R : BufRead + ?Sized > (
95
+ fn read_until_internal < R : AsyncBufRead + ?Sized > (
95
96
mut reader : Pin < & mut R > ,
96
97
cx : & mut Context < ' _ > ,
97
98
buf : & mut Vec < u8 > ,
0 commit comments