in features 0.1
let a :feautures::sync::mpsc::Receiver<test>
a.for_each( move |b| { })
what will be like in feature 0.3
async move{
let a :feautures::sync::mpsc::Receiver<test>
while let b = a.next().await{
}
}
i don't know how to call the mpsc channel can somebody help me ?
alice
2
You receive on it like this:
use futures::stream::StreamExt;
while let Some(item) = recv.next().await {
// use item here ...
}
Note that Tokio also provides a channel, which does not need an import of StreamExt
.
// using tokio::sync::mpsc
while let Some(item) = recv.recv().await {
// use item here ...
}
futures_channel::mpsc::Receiver<miner::NonceData>
current my channel is that how can i change it?
system
Closed
4
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.