Crates.io | amap |
lib.rs | amap |
version | 0.1.2 |
source | src |
created_at | 2023-08-15 01:45:51.886897 |
updated_at | 2023-08-20 05:15:16.908917 |
description | define `[Option |
homepage | |
repository | https://github.com/bend-n/amap.git |
max_upload_size | |
id | 944672 |
size | 7,266 |
Simple array initialization macro.
HashMap<usize, T>
, and started thinking, wouldn't it be nice if this was a array?No?
Well now you can! Its as simple as
amap! {
4 => 56,
2 => 32,
} // creates a [Option<i32>; 5] for all your indexing needs
Patterns got you covered!
amap! {
0..=4 => 2,
5 | 6 => 3,
}
It's just a array!
const ID_MAP: [Option<i32>; 6] = amap! {
5 => 6,
2 => 1,
}