Crates.io | array_init_macro |
lib.rs | array_init_macro |
version | 0.1.2 |
source | src |
created_at | 2022-11-30 10:11:36.958 |
updated_at | 2022-11-30 10:26:51.608069 |
description | Simple initialization macro for arrays. |
homepage | |
repository | https://github.com/ramon54321/array_init_macro.git |
max_upload_size | |
id | 726090 |
size | 2,581 |
Provides a simple macro to initialize an array given a type, size and value.
use array_init_macro::arr;
fn main() {
// [1, 1, 1, 1]
let array0 = arr![u8; 4; 1];
// [1, 1, 1, 1]
let array1 = arr![u32; 4; 1];
// [Vec[1, 2], Vec[1, 2], Vec[1, 2], Vec[1, 2]]
let array2 = arr![Vec<u8>; 4; vec![1, 2]];
}