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

#78 in Data structures

Download history 27230/week @ 2025-01-03 33780/week @ 2025-01-10 35005/week @ 2025-01-17 34950/week @ 2025-01-24 38343/week @ 2025-01-31 36236/week @ 2025-02-07 29450/week @ 2025-02-14 35868/week @ 2025-02-21 29960/week @ 2025-02-28 31013/week @ 2025-03-07 35505/week @ 2025-03-14 35042/week @ 2025-03-21 34517/week @ 2025-03-28 34824/week @ 2025-04-04 34530/week @ 2025-04-11 29735/week @ 2025-04-18

141,943 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