let r: futures::channel::mpsc::Receiver<String> = ... ;
wasm_bindgen_futures::spawn_local(async move {
for x in ... ??? {
println!("msg: {:?}", x);
}
})
I am trying to figure out how to write an async task whose sole purpose in life is to dump out all msgs from a mpsc::Receiver<String> and am not figuring it out via autocompletion. Is there a trivial way to do this (or a reason it can't be done) ?
Oh, thought the api would be more alike... My bad
That Receiver has a next method tho (due to an impl for the StreamExt trait): Receiver in futures::channel::mpsc - Rust, which returns a future that resolves to the next item, which should be what you're looking for