(_event: LambdaEvent<Value>)
| 7 | use std::{thread, time::Duration}; |
| 8 | |
| 9 | async fn func(_event: LambdaEvent<Value>) -> Result<Response<Body>, Error> { |
| 10 | let messages = ["Hello", "world", "from", "Lambda!"]; |
| 11 | |
| 12 | let (mut tx, rx) = channel(); |
| 13 | |
| 14 | tokio::spawn(async move { |
| 15 | for message in messages.iter() { |
| 16 | tx.send_data((message.to_string() + "\n").into()).await.unwrap(); |
| 17 | thread::sleep(Duration::from_millis(500)); |
| 18 | } |
| 19 | }); |
| 20 | |
| 21 | Ok(Response::from(rx)) |
| 22 | } |
| 23 | |
| 24 | #[tokio::main] |
| 25 | async fn main() -> Result<(), Error> { |