diff --git a/examples/double-agent.rs b/examples/double-agent.rs index b577ca7..98d3dd8 100755 --- a/examples/double-agent.rs +++ b/examples/double-agent.rs @@ -22,9 +22,8 @@ impl SharedState { } async fn counter_agent_1(mut stream: CStream, ctx: Context) -> Result<()> { - while let Some(msg) = stream.next().await { + while let Some(Some(m)) = stream.next().await { // Read the incoming bytes as string - let m = msg.unwrap(); let _strm = m .payload_view::() .ok_or(CallystoError::GeneralError("Payload view failure".into()))??; @@ -50,9 +49,8 @@ async fn counter_agent_1(mut stream: CStream, ctx: Context) -> Resu } async fn counter_agent_2(mut stream: CStream, ctx: Context) -> Result<()> { - while let Some(msg) = stream.next().await { + while let Some(Some(m)) = stream.next().await { // Read the incoming bytes as string - let m = msg.unwrap(); let _strm = m .payload_view::() .ok_or(CallystoError::GeneralError("Payload view failure".into()))??; diff --git a/examples/manual-commit.rs b/examples/manual-commit.rs index 1e42d1b..915fe79 100644 --- a/examples/manual-commit.rs +++ b/examples/manual-commit.rs @@ -18,8 +18,7 @@ impl SharedState { } async fn manual_commit_counter_agent(mut stream: CStream, ctx: Context) -> Result<()> { - while let Some(msg) = stream.next().await { - let m = msg.unwrap(); + while let Some(Some(m)) = stream.next().await { // Read the incoming bytes as string let strm = m.payload_view::().unwrap().unwrap().to_owned(); println!("Received payload: `{}`", strm);