list_compression 0.1.0

A library crate that provides a MBE that simulates the 'list by understanding' of python in a idiomatic way
Documentation
list_compression-0.1.0 has been yanked.

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]);