Skip to content

Commit

Permalink
Merge pull request #85 from vertexclique/fix-examples
Browse files Browse the repository at this point in the history
Fix examples
  • Loading branch information
vertexclique authored Jun 28, 2022
2 parents 3da9b02 + 29454eb commit 5324739
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 2 additions & 4 deletions examples/double-agent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,8 @@ impl SharedState {
}

async fn counter_agent_1(mut stream: CStream, ctx: Context<SharedState>) -> 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::<str>()
.ok_or(CallystoError::GeneralError("Payload view failure".into()))??;
Expand All @@ -50,9 +49,8 @@ async fn counter_agent_1(mut stream: CStream, ctx: Context<SharedState>) -> Resu
}

async fn counter_agent_2(mut stream: CStream, ctx: Context<SharedState>) -> 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::<str>()
.ok_or(CallystoError::GeneralError("Payload view failure".into()))??;
Expand Down
3 changes: 1 addition & 2 deletions examples/manual-commit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ impl SharedState {
}

async fn manual_commit_counter_agent(mut stream: CStream, ctx: Context<SharedState>) -> 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::<str>().unwrap().unwrap().to_owned();
println!("Received payload: `{}`", strm);
Expand Down

0 comments on commit 5324739

Please sign in to comment.