Skip to content

Commit 3175751

Browse files
committed
Simplify async channel example
This removes a nested import (which I find hard to read) and removes an unnecessary type annotation.
1 parent 8d8a8b6 commit 3175751

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/concurrency/async-control-flow/channels.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use tokio::sync::mpsc::{self, Receiver};
1+
use tokio::sync::mpsc;
22

3-
async fn ping_handler(mut input: Receiver<()>) {
4-
let mut count: usize = 0;
3+
async fn ping_handler(mut input: mpsc::Receiver<()>) {
4+
let mut count = 0;
55

66
while let Some(_) = input.recv().await {
77
count += 1;

0 commit comments

Comments
 (0)