[][src]Macro iter_python::vec_it

macro_rules! vec_it {
    (
        $expr:expr ,
        for $var:pat in $iterable:expr
        $(
            ,
            $($if_cond:tt)*
        )?
    ) => { ... };
    (@parsing_mapped_expr
        $fallback_to_vec:tt
    ) => { ... };
    (@parsing_mapped_expr
        $mapped_expression:tt
        for
        $($rest:tt)*
    ) => { ... };
    (@parsing_mapped_expr
        [ $($mapped_expression_tts:tt)* ]
        $current_tt:tt
        $($rest:tt)*
    ) => { ... };
    (@parsing_for
        [ $($mapped_expression_tts:tt)* ]
        [ $($for_body_tts:tt)* ]
    ) => { ... };
    (@parsing_for
        [ $($mapped_expression_tts:tt)* ]
        [ $($for_body_tts:tt)* ]
        if
        $($rest:tt)*
    ) => { ... };
    (@parsing_for
        $mapped_expression:tt
        [ $($for_body_tts:tt)* ]
        $current_tt:tt
        $($rest:tt)*
    ) => { ... };
    (
        $($tt: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 blob imports.