Macro v

Source
macro_rules! v {
    (
        $($e:expr),* $(,)?
    ) => { ... };
    (
        $e:expr ; $count:expr
    ) => { ... };
    (
        $($otherwise:tt)*
    ) => { ... };
}
Available on crate feature std only.
Expand description

(shortname: v!) — Python “list” comprehensions: same as i!, but collected into a Vec instead.

§v! or vec!?

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

§Example

use ::iter_python::macros::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.