Skip to content

Commit

Permalink
don't hardcode a channel in the examples
Browse files Browse the repository at this point in the history
  • Loading branch information
museun committed Aug 29, 2020
1 parent 7e70e44 commit 3f3c0db
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 12 deletions.
8 changes: 5 additions & 3 deletions examples/async_io_demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,9 +167,11 @@ fn main() -> anyhow::Result<()> {
.detach();

// you can encode all sorts of 'commands'
writer
.encode(commands::privmsg("#museun", "hello world!"))
.await?;
for channel in &channels {
writer
.encode(commands::privmsg(channel, "hello world!"))
.await?;
}

println!("starting main loop");
// your 'main loop'. you'll just call next_message() until you're done
Expand Down
9 changes: 6 additions & 3 deletions examples/async_std_demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,12 @@ async fn main() -> anyhow::Result<()> {
});

// you can encode all sorts of 'commands'
writer
.encode(commands::privmsg("#museun", "hello world!"))
.await?;

for channel in &channels {
writer
.encode(commands::privmsg(channel, "hello world!"))
.await?;
}

println!("starting main loop");
// your 'main loop'. you'll just call next_message() until you're done
Expand Down
8 changes: 5 additions & 3 deletions examples/smol_demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,11 @@ fn main() -> anyhow::Result<()> {
.detach();

// you can encode all sorts of 'commands'
writer
.encode(commands::privmsg("#museun", "hello world!"))
.await?;
for channel in &channels {
writer
.encode(commands::privmsg(channel, "hello world!"))
.await?;
}

println!("starting main loop");
// your 'main loop'. you'll just call next_message() until you're done
Expand Down
8 changes: 5 additions & 3 deletions examples/tokio_demo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,11 @@ async fn main() -> anyhow::Result<()> {
});

// you can encode all sorts of 'commands'
writer
.encode(commands::privmsg("#museun", "hello world!"))
.await?;
for channel in &channels {
writer
.encode(commands::privmsg(channel, "hello world!"))
.await?;
}

println!("starting main loop");
// your 'main loop'. you'll just call next_message() until you're done
Expand Down

0 comments on commit 3f3c0db

Please sign in to comment.