macro_rules! arr {
[$item:expr ; $len:expr ; { $( $index:tt : $value:expr ),* $(,)? }] => { ... };
[$item:expr ; $len:expr] => { ... };
[$( $item:expr ),* $(,)?] => { ... };
(impl $arr:ident { [$start:tt] : [ $value:expr ; $len:expr ] }) => { ... };
(impl $arr:ident { [$start:tt] : [ $($value:expr),* $(,)? ] }) => { ... };
(impl $arr:ident { [$start:tt] : $value:expr }) => { ... };
(impl $arr:ident { $key:tt : $value:expr }) => { ... };
}
A macro for array literals with superpowers.
See the module level documentation for more.
let a = arr![1; 5; { [0]: [1, 2], 4: 0 }];
assert_eq!(a, [1, 2, 1, 1, 0]);