33
33
C : Consumer < Self :: Item , Self :: Future > ,
34
34
{
35
35
let mut iter = pin ! ( self . stream) ;
36
+ let mut consumer = pin ! ( consumer) ;
36
37
37
38
// Concurrently progress the consumer as well as the stream. Whenever
38
39
// there is an item from the stream available, we submit it to the
53
54
54
55
// Drive the consumer forward
55
56
let b = async {
56
- let control_flow = consumer. progress ( ) . await ;
57
+ let control_flow = consumer. as_mut ( ) . progress ( ) . await ;
57
58
State :: Progress ( control_flow)
58
59
} ;
59
60
@@ -64,14 +65,14 @@ where
64
65
ConsumerState :: Break => break ,
65
66
ConsumerState :: Continue => continue ,
66
67
ConsumerState :: Empty => match iter. next ( ) . await {
67
- Some ( item) => match consumer. send ( ready ( item) ) . await {
68
+ Some ( item) => match consumer. as_mut ( ) . send ( ready ( item) ) . await {
68
69
ConsumerState :: Break => break ,
69
70
ConsumerState :: Empty | ConsumerState :: Continue => continue ,
70
71
} ,
71
72
None => break ,
72
73
} ,
73
74
} ,
74
- State :: Item ( Some ( item) ) => match consumer. send ( ready ( item) ) . await {
75
+ State :: Item ( Some ( item) ) => match consumer. as_mut ( ) . send ( ready ( item) ) . await {
75
76
ConsumerState :: Break => break ,
76
77
ConsumerState :: Empty | ConsumerState :: Continue => continue ,
77
78
} ,
81
82
82
83
// We will no longer receive items from the underlying stream, which
83
84
// means we're ready to wait for the consumer to finish up.
84
- consumer. flush ( ) . await
85
+ consumer. as_mut ( ) . flush ( ) . await
85
86
}
86
87
87
88
fn concurrency_limit ( & self ) -> Option < NonZeroUsize > {
0 commit comments