exhaustive /ɪɡˈzɔːstɪv,ɛɡˈzɔːstɪv/ - including or considering all elements or aspects; fully comprehensive.
This crate was born from issue #23 in dtolnay/proc_macro_workshop
.
I'd like to see a basic implementation of a macro for Python-style list and map comprehensions, and decide whether it would be a better teaching example for function-like proc macros than the current
seq!
project.Something like:
let squares_map = c![n => n*n for n in 0..100 if n % 5 != 0];
There are some crates which implement this functionality or really similar,
however, most of the crates are implemented using macro_rules!
.
Captain Obvious: Which is not a procedural macro and thus not adequate as a learning example of such.
The existing crates are:
cute
- Macro for Python-esque list comprehensions in Rust.mapcomp
- Python-like list comprehension via macros for some standard containers.iter-comprehensions
- A library for iterator comprehensions.comprehension
- Iterator comprehension in Rust.
The last one, comprehension
, is the only one implemented using function-like procedural macros,
however the syntax is based on Haskell, not Python.