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

#104 in Data structures

Download history 26433/week @ 2024-10-26 26961/week @ 2024-11-02 23105/week @ 2024-11-09 25915/week @ 2024-11-16 28252/week @ 2024-11-23 35187/week @ 2024-11-30 36175/week @ 2024-12-07 36589/week @ 2024-12-14 9395/week @ 2024-12-21 11787/week @ 2024-12-28 29638/week @ 2025-01-04 34900/week @ 2025-01-11 34506/week @ 2025-01-18 35595/week @ 2025-01-25 38324/week @ 2025-02-01 35416/week @ 2025-02-08

150,809 downloads per month
Used in 93 crates (16 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