8 stable releases

2.1.8 Nov 8, 2023
2.1.5 May 29, 2022
2.1.3 Apr 27, 2022
2.1.1 Jan 27, 2022
0.1.2 Nov 18, 2017

#97 in Data structures

Download history 23487/week @ 2024-03-14 22355/week @ 2024-03-21 20661/week @ 2024-03-28 21899/week @ 2024-04-04 21722/week @ 2024-04-11 22188/week @ 2024-04-18 21824/week @ 2024-04-25 21461/week @ 2024-05-02 22969/week @ 2024-05-09 22249/week @ 2024-05-16 20264/week @ 2024-05-23 22589/week @ 2024-05-30 20367/week @ 2024-06-06 22387/week @ 2024-06-13 20514/week @ 2024-06-20 14190/week @ 2024-06-27

81,696 downloads per month
Used in 84 crates (13 directly)

MIT/Apache

12KB
102 lines

array-macro

Array multiple elements constructor syntax.


lib.rs:

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

No runtime deps