1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-05-23 02:40:13 +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:
Martin Geisler 2024-06-20 00:30:42 +02:00
parent 8d8a8b6f76
commit 317575131e

View File

@ -1,7 +1,7 @@
use tokio::sync::mpsc::{self, Receiver};
use tokio::sync::mpsc;
async fn ping_handler(mut input: Receiver<()>) {
let mut count: usize = 0;
async fn ping_handler(mut input: mpsc::Receiver<()>) {
let mut count = 0;
while let Some(_) = input.recv().await {
count += 1;