8 stable releases
2.1.8 | Nov 8, 2023 |
---|---|
2.1.5 | May 29, 2022 |
2.1.3 | Apr 27, 2022 |
2.1.1 |
|
0.1.2 |
|
#95 in Data structures
100,146 downloads per month
Used in 100 crates
(17 directly)
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]);