| Crates.io | arr_ty |
| lib.rs | arr_ty |
| version | 0.4.0 |
| created_at | 2023-04-02 19:00:19.166447+00 |
| updated_at | 2025-07-24 10:37:23.073733+00 |
| description | Macros for smart array initialization. |
| homepage | |
| repository | https://github.com/nossie531/arr_ty |
| max_upload_size | |
| id | 828548 |
| size | 20,336 |
Macros for smart array initialization.
The author of this crate is not good at English.
Forgive me if the document is hard to read.
This crate makes Rust array initialization a little smarter.
This crate will be useless by feature generic_arg_infer
(See rust issue #85077 for more details).
However, as of 2025, there are cases where redundant number specifications are required at array initialization.
This is not possible.
let arr = [0, 1, 2] as [u32;_];
With this crate.
let arr = arr_ty!(u32; [0, 1, 2]);
Without this crate, manual counting approach.
let arr = [0, 1, 2] as [u32;3];
Without this crate, redundant type approach.
let arr = [0u32, 1u32, 2u32];
Without this crate, no unity approach.
let arr = [0u32, 1, 2];
This is not possible.
let arr: [Box<dyn Any>; _] = [
Box::new(0),
Box::new(false),
Box::new("false")
];
With this crate.
let arr = arr_ty!(Box<dyn Any>; [
Box::new(0),
Box::new(false),
Box::new("false")
]);
Without this crate, manual counting approach.
let arr: [Box<dyn Any>; 3] = [
Box::new(0),
Box::new(false),
Box::new("false")
];
Without this crate, redundant cast approach.
let arr = [
Box::new(0) as Box<dyn Any>,
Box::new(false) as Box<dyn Any>,
Box::new("false") as Box<dyn Any>
];
Without this crate, no unity approach.
let arr = [
Box::new(0) as Box<dyn Any>,
Box::new(false),
Box::new("false")
];
See CHANGELOG.