The following code works:
let url = url::Url::parse(url).unwrap();
let (ws_stream, _) = connect_async(url).await.expect("Failed to connect");
let (_, read) = ws_stream.split();
read.for_each( |message| async {})
// ...
But for the follow code
let url = url::Url::parse(url).unwrap();
let (ws_stream, _) = connect_async(url).await.expect("Failed to connect");
let (_, read) = ws_stream.split();
read.for_each(async |message| {})
// ...
I get:
= note: see issue #62290 https://github.com/rust-lang/rust/issues/62290 for more information
= help: add#![feature(async_closure)]
to the crate attributes to enable
= note: this error originates in a macro (in Nightly builds, run with -Z macro-backtrace for more info)
What is the difference bewteen || async {} vs. async || {}? Aren't they all async closure?