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

#82 in Data structures

Download history 32616/week @ 2025-03-08 35511/week @ 2025-03-15 34436/week @ 2025-03-22 35341/week @ 2025-03-29 34689/week @ 2025-04-05 33234/week @ 2025-04-12 30939/week @ 2025-04-19 30228/week @ 2025-04-26 31546/week @ 2025-05-03 35858/week @ 2025-05-10 29934/week @ 2025-05-17 31330/week @ 2025-05-24 30607/week @ 2025-05-31 31562/week @ 2025-06-07 34619/week @ 2025-06-14 40557/week @ 2025-06-21

143,507 downloads per month
Used in 92 crates (16 directly)

MIT/Apache

12KB
102 lines

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

array-macro

Array multiple elements constructor syntax.

No runtime deps