[][src]Macro iter_python::vec_it

macro_rules! vec_it {
    (
        $expr:expr ,
        for $var:pat in $iterable:expr
        $(
            ,
            $($if_cond:tt)*
        )?
    ) => { ... };
    (
        $($fallback_to_std_vec:tt)*
    ) => { ... };
}

Python "list" comprehensions: same as iter!, but collected into a Vec instead.

vec_it! or vec!?

vec_it! fallbacks to ::std::vec! functionality, thus allowing maximum compatiblity!

Example

This code runs with edition 2018
use ::iter_python::vec_it as vec;

let v1 = vec![i, for i in 1 ..= 4];
let v2 = vec![1, 2, 3, 4];
assert_eq!(v1, v2);

It has not been named vec to prevent lints against ambiguous glob imports.