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

#95 in Data structures

Download history 21293/week @ 2024-07-17 23589/week @ 2024-07-24 25802/week @ 2024-07-31 21679/week @ 2024-08-07 22387/week @ 2024-08-14 22620/week @ 2024-08-21 27606/week @ 2024-08-28 27235/week @ 2024-09-04 28807/week @ 2024-09-11 24835/week @ 2024-09-18 26023/week @ 2024-09-25 20603/week @ 2024-10-02 18933/week @ 2024-10-09 24857/week @ 2024-10-16 27611/week @ 2024-10-23 26313/week @ 2024-10-30

100,146 downloads per month
Used in 100 crates (17 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