macro_rules! cmap {
    ($key:expr => $value:expr; $($tokens: tt)+) => { ... };
}
Expand description

Build HashMap from collection iterator comprehensions.

Limitations

  • Only 3 nested comprehensions

Examples:

use sugars::cmap;

let a = 10;
let w = cmap!{x => x+a; x in 1..10};
let z = cmap!{x => x+a; x in 1..10, if x%2 == 0};