| Crates.io | assoc |
| lib.rs | assoc |
| version | 0.1.3 |
| created_at | 2021-02-28 22:35:00.254933+00 |
| updated_at | 2023-01-31 03:14:54.740611+00 |
| description | Treat vectors like associative arrays |
| homepage | https://github.com/mingyli/assoc |
| repository | https://github.com/mingyli/assoc |
| max_upload_size | |
| id | 362020 |
| size | 26,838 |
Treat vectors like associative arrays.
use assoc::AssocExt;
let mut map = vec![("a", 1), ("b", 2)];
map.entry("c").or_insert(3);
assert_eq!(map.get(&"c"), Some(&3));
assert_eq!(map.entry("c").or_insert(4), &3);