Crate array_macro

source ·
Expand description

Array multiple elements constructor syntax.

While Rust does provide those, they require copy, and you cannot obtain the index that will be created. This crate provides syntax that fixes both of those issues.

Examples

assert_eq!(array![String::from("x"); 2], [String::from("x"), String::from("x")]);
assert_eq!(array![x => x; 3], [0, 1, 2]);

Macros

  • Creates an array containing the arguments.