MCPcopy Index your code
hub / github.com/aws/aws-lambda-rust-runtime / func

Function func

examples/basic-streaming-response/src/main.rs:9–22  ·  view source on GitHub ↗
(_event: LambdaEvent<Value>)

Source from the content-addressed store, hash-verified

7use std::{thread, time::Duration};
8
9async 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]
25async fn main() -> Result<(), Error> {

Callers

nothing calls this directly

Calls 2

send_dataMethod · 0.80
channelFunction · 0.50

Tested by

no test coverage detected