taiki-e / futures-async-stream

Async stream for Rust and the futures crate.
https://docs.rs/futures-async-stream
Apache License 2.0
174 stars 9 forks source link

Procedural macros provided by futures-async-stream cannot handle expressions in macros #4

Open taiki-e opened 5 years ago

taiki-e commented 5 years ago

Currently, procedural macros provided by futures-async-stream cannot handle expressions in macros.

https://github.com/rust-lang-nursery/futures-rs/pull/1548#discussion_r285341883:

It is not possible to replace .await in macros such as assert!(foo.await) with this.

Full support for this can not be done without compiler support, but it can support for some kinds of macros (however, this is not necessarily preferable, as a macro may call an async block etc): https://github.com/taiki-e/futures-rs/commit/fb33504229db314fb97759c3170ee3ad73785c08

Related: https://github.com/Nemo157/embrio-rs/issues/14

Refs: https://github.com/taiki-e/futures-async-stream/commit/5198fe4eced00a23b7a0235bc1333d4535fe3501

douglas-raillard-arm commented 1 year ago

Also looks like yield in a macro is not possible. I was trying to use a local macro to limit code duplication inside a function.