1
- use crate :: stream:: { StreamExt , TryStreamExt , Fuse , IntoStream } ;
1
+ use crate :: stream:: { StreamExt , TryStreamExt , Fuse } ;
2
2
use core:: fmt;
3
3
use core:: pin:: Pin ;
4
4
use futures_core:: future:: Future ;
5
- use futures_core:: stream:: TryStream ;
5
+ use futures_core:: stream:: { TryStream , Stream } ;
6
6
use futures_core:: task:: { Context , Poll } ;
7
7
use futures_sink:: Sink ;
8
8
@@ -12,20 +12,18 @@ use futures_sink::Sink;
12
12
pub struct SendAll < ' a , Si , St >
13
13
where
14
14
Si : ?Sized ,
15
- St : ?Sized ,
16
- & ' a mut St : TryStream ,
15
+ St : ?Sized + TryStream ,
17
16
{
18
17
sink : & ' a mut Si ,
19
- stream : Fuse < IntoStream < & ' a mut St > > ,
20
- buffered : Option < < & ' a mut St as TryStream > :: Ok > ,
18
+ stream : Fuse < & ' a mut St > ,
19
+ buffered : Option < St :: Ok > ,
21
20
}
22
21
23
- impl < ' a , Si , St > fmt:: Debug for SendAll < ' a , Si , St >
22
+ impl < Si , St > fmt:: Debug for SendAll < ' _ , Si , St >
24
23
where
25
24
Si : fmt:: Debug + ?Sized ,
26
- St : fmt:: Debug + ?Sized ,
27
- & ' a mut St : TryStream ,
28
- <& ' a mut St as TryStream >:: Ok : fmt:: Debug ,
25
+ St : fmt:: Debug + ?Sized + TryStream ,
26
+ St :: Ok : fmt:: Debug ,
29
27
{
30
28
fn fmt ( & self , f : & mut fmt:: Formatter < ' _ > ) -> fmt:: Result {
31
29
f. debug_struct ( "SendAll" )
@@ -37,34 +35,32 @@ where
37
35
}
38
36
39
37
// Pinning is never projected to any fields
40
- impl < ' a , Si , St > Unpin for SendAll < ' a , Si , St >
38
+ impl < Si , St > Unpin for SendAll < ' _ , Si , St >
41
39
where
42
40
Si : Unpin + ?Sized ,
43
- St : ?Sized ,
44
- & ' a mut St : TryStream + Unpin ,
41
+ St : TryStream + Unpin + ?Sized ,
45
42
{ }
46
43
47
44
impl < ' a , Si , St , Ok , Error > SendAll < ' a , Si , St >
48
45
where
49
46
Si : Sink < Ok , Error = Error > + Unpin + ?Sized ,
50
- St : ?Sized ,
51
- & ' a mut St : TryStream < Ok = Ok , Error = Error > + Unpin ,
47
+ St : TryStream < Ok = Ok , Error = Error > + Stream + Unpin + ?Sized ,
52
48
{
53
49
pub ( super ) fn new (
54
50
sink : & ' a mut Si ,
55
51
stream : & ' a mut St ,
56
52
) -> SendAll < ' a , Si , St > {
57
53
SendAll {
58
54
sink,
59
- stream : stream. into_stream ( ) . fuse ( ) ,
55
+ stream : stream. fuse ( ) ,
60
56
buffered : None ,
61
57
}
62
58
}
63
59
64
60
fn try_start_send (
65
61
& mut self ,
66
62
cx : & mut Context < ' _ > ,
67
- item : < & ' a mut St as TryStream > :: Ok ,
63
+ item : St :: Ok ,
68
64
) -> Poll < Result < ( ) , Si :: Error > > {
69
65
debug_assert ! ( self . buffered. is_none( ) ) ;
70
66
match Pin :: new ( & mut self . sink ) . poll_ready ( cx) ? {
@@ -79,11 +75,10 @@ where
79
75
}
80
76
}
81
77
82
- impl < ' a , Si , St , Ok , Error > Future for SendAll < ' a , Si , St >
78
+ impl < Si , St , Ok , Error > Future for SendAll < ' _ , Si , St >
83
79
where
84
80
Si : Sink < Ok , Error = Error > + Unpin + ?Sized ,
85
- St : ?Sized ,
86
- & ' a mut St : TryStream < Ok = Ok , Error = Error > + Unpin ,
81
+ St : Stream < Item = Result < Ok , Error > > + Unpin + ?Sized ,
87
82
{
88
83
type Output = Result < ( ) , Error > ;
89
84
0 commit comments