vec-map
A simple alternative to HashMap inspired on JavaScript's Map
.
use vec_map::Map;
let mut map = Map::new();
map.set("hello", "world");
map.set("hello2", "test");
assert_eq!(map.get("hello"), Some("world"));
assert_eq!(map.get("hello2"), Some("test"));
map.set("hello", "world (again)");
assert_eq!(map.get("hello"), Some("world (again)"));
assert_eq!(map.size, 2);
assert_eq!(
format!("{}", map),
r#"Map(2) [("hello", "world (again)"), ("hello2", "test")]"#
)
Usage
Add this to your Cargo.toml
dependencies:
vec-map = { git = "https://github.com/Squioole/map" }