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

#121 in Data structures

Download history 17898/week @ 2023-11-21 21722/week @ 2023-11-28 16591/week @ 2023-12-05 18904/week @ 2023-12-12 12654/week @ 2023-12-19 6578/week @ 2023-12-26 14243/week @ 2024-01-02 17288/week @ 2024-01-09 19707/week @ 2024-01-16 17706/week @ 2024-01-23 17775/week @ 2024-01-30 19665/week @ 2024-02-06 21351/week @ 2024-02-13 19509/week @ 2024-02-20 20699/week @ 2024-02-27 16944/week @ 2024-03-05

81,748 downloads per month
Used in 89 crates (13 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