Expand description
This module defines a DynMap
– a container for heterogeneous maps.
This means that DynMap
stores a bunch of hash maps inside, and those maps
can be of different types.
It is used like this:
// keys define submaps of a `DynMap`
const STRING_TO_U32: Key<String, u32> = Key::new();
const U32_TO_VEC: Key<u32, Vec<bool>> = Key::new();
// Note: concrete type, no type params!
let mut map = DynMap::new();
// To access a specific map, index the `DynMap` by `Key`:
map[STRING_TO_U32].insert("hello".to_string(), 92);
let value = map[U32_TO_VEC].get(92);
assert!(value.is_none());
This is a work of fiction. Any similarities to Kotlin’s BindingContext
are
a coincidence.