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

#92 in Data structures

Download history 22510/week @ 2024-07-23 25754/week @ 2024-07-30 22435/week @ 2024-08-06 22786/week @ 2024-08-13 21437/week @ 2024-08-20 26433/week @ 2024-08-27 28616/week @ 2024-09-03 28141/week @ 2024-09-10 25476/week @ 2024-09-17 26111/week @ 2024-09-24 23169/week @ 2024-10-01 16783/week @ 2024-10-08 24010/week @ 2024-10-15 27609/week @ 2024-10-22 27147/week @ 2024-10-29 20937/week @ 2024-11-05

103,305 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