#array #no-std

no-std array-macro

Array multiple elements constructor syntax

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

#139 in Data structures

Download history 44962/week @ 2025-10-26 52422/week @ 2025-11-02 31375/week @ 2025-11-09 57629/week @ 2025-11-16 58509/week @ 2025-11-23 56835/week @ 2025-11-30 59053/week @ 2025-12-07 58938/week @ 2025-12-14 18999/week @ 2025-12-21 21641/week @ 2025-12-28 12965/week @ 2026-01-04 44129/week @ 2026-01-11 66426/week @ 2026-01-18 75830/week @ 2026-01-25 75582/week @ 2026-02-01 67124/week @ 2026-02-08

285,489 downloads per month
Used in 94 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