app_async: use for_each_concurrent
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
6d850be1dc
commit
797f781959
@ -57,15 +57,18 @@ async fn zip_reader_task(tx: UnboundedSender<Question>) {
|
|||||||
let source_questions = source_questions.stream();
|
let source_questions = source_questions.stream();
|
||||||
pin_mut!(source_questions);
|
pin_mut!(source_questions);
|
||||||
|
|
||||||
let converter = source_questions.converter().convert();
|
source_questions
|
||||||
pin_mut!(converter);
|
.converter()
|
||||||
|
.convert()
|
||||||
let mut num: u32 = 0;
|
.enumerate()
|
||||||
while let Some(mut question) = converter.next().await {
|
.map(|(num, mut question)| {
|
||||||
question.num = 1 + num;
|
question.num = 1 + (num as u32);
|
||||||
|
question
|
||||||
|
})
|
||||||
|
.for_each_concurrent(None, |question| async {
|
||||||
tx.send(question).expect("send");
|
tx.send(question).expect("send");
|
||||||
num += 1;
|
})
|
||||||
}
|
.await;
|
||||||
|
|
||||||
println!("read done");
|
println!("read done");
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user