[][src]Crate list_compression

A crate that provides a MBE to simulate the 'lists by understanding' of python in Rust and almost a zero-cost abstraction.

The macro takes an expression to use in a for loop, a pattern for this, a collection and a optional boolean expression, all of them separated with commas.

Usage

Because here we used a boolean the default code never reaches.

let vec = vec![1, 2, 3];
#[allow(unreachable_code)] // needed here to prevent warnings
let vec = py_list![*i += 10, i, vec,*i != 2];
 
assert_eq!(vec, vec![11, 2, 13]);

Macros

py_list