mirror of
https://github.com/google/comprehensive-rust.git
synced 2025-05-24 11:13:48 +02:00
Simplify async channel example
This removes a nested import (which I find hard to read) and removes an unnecessary type annotation.
This commit is contained in:
parent
8d8a8b6f76
commit
317575131e
@ -1,7 +1,7 @@
|
|||||||
use tokio::sync::mpsc::{self, Receiver};
|
use tokio::sync::mpsc;
|
||||||
|
|
||||||
async fn ping_handler(mut input: Receiver<()>) {
|
async fn ping_handler(mut input: mpsc::Receiver<()>) {
|
||||||
let mut count: usize = 0;
|
let mut count = 0;
|
||||||
|
|
||||||
while let Some(_) = input.recv().await {
|
while let Some(_) = input.recv().await {
|
||||||
count += 1;
|
count += 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user