36
36
pub use crate :: types:: Context ;
37
37
use client:: Client ;
38
38
use futures:: stream:: { Stream , StreamExt } ;
39
- use genawaiter:: { sync:: gen, yield_} ;
40
39
pub use lambda_attributes:: lambda;
41
40
use serde:: { Deserialize , Serialize } ;
42
41
use std:: {
@@ -179,17 +178,18 @@ where
179
178
}
180
179
181
180
fn incoming ( client : & Client ) -> impl Stream < Item = Result < http:: Response < hyper:: Body > , Error > > + ' _ {
182
- gen ! ( {
181
+ async_stream :: stream! {
183
182
loop {
184
183
let req = NextEventRequest . into_req( ) . expect( "Unable to construct request" ) ;
185
- yield_!( client. call( req) . await )
184
+ let res = client. call( req) . await ;
185
+ yield res;
186
186
}
187
- } )
187
+ }
188
188
}
189
189
190
190
async fn run_inner < A , B , F > (
191
191
client : & Client ,
192
- incoming : impl Stream < Item = Result < http:: Response < hyper:: Body > , Error > > + Unpin ,
192
+ incoming : impl Stream < Item = Result < http:: Response < hyper:: Body > , Error > > ,
193
193
handler : & mut F ,
194
194
) -> Result < ( ) , Error >
195
195
where
@@ -198,7 +198,8 @@ where
198
198
A : for < ' de > Deserialize < ' de > ,
199
199
B : Serialize ,
200
200
{
201
- let mut incoming = incoming;
201
+ tokio:: pin!( incoming) ;
202
+
202
203
while let Some ( event) = incoming. next ( ) . await {
203
204
let event = event?;
204
205
let ( parts, body) = event. into_parts ( ) ;
0 commit comments