Expand description
A small library and custom derive to create a map-like struct that uses match expressions to get and insert values.
If you know your keys at compile-time, this library will likely be faster than HashMap for supported map operations.
Provides map operations through strict::MapLike, which returns an error when attempting to use unknown keys, and
easy::MapLike, which ignores missing keys and more closely matches the HashMap API.
§Usage
use fast_map::easy::MapLike;
fn main() {
pub enum A { A, B, C, D };
#[derive(Default, fast_map::FastMap)]
#[fast_map(keys(A::A, A::B, A::C, A::D))]
struct Foo(fast_map::Map4<A, String>);
let mut foo = Foo::default();
foo.insert(A::B, "B".into());
assert_eq!(foo.get(A::B), Some(&"B".to_string()));
assert_eq!(foo.get(A::C), None);
foo.insert(A::C, "C".into());
assert_eq!(foo.values().collect::<Vec<_>>().len(), 2);
}Modules§
- Provides a
MapLiketrait that ignores errors on missing keys (more likeHashMapAPI) - Provides a
MapLiketrait that errors when trying togetorinsertmissing keys
Structs§
- Container for a
mapwith 1 field - Container for a
mapwith 2 fields - Container for a
mapwith 3 fields - Container for a
mapwith 4 fields - Container for a
mapwith 5 fields - Container for a
mapwith 6 fields - Container for a
mapwith 7 fields - Container for a
mapwith 8 fields - Container for a
mapwith 9 fields - Container for a
mapwith 10 fields - Container for a
mapwith 11 fields - Container for a
mapwith 12 fields - Container for a
mapwith 13 fields - Container for a
mapwith 14 fields - Container for a
mapwith 15 fields - Container for a
mapwith 16 fields - Container for a
mapwith 17 fields - Container for a
mapwith 18 fields - Container for a
mapwith 19 fields - Container for a
mapwith 20 fields - Container for a
mapwith 21 fields - Container for a
mapwith 22 fields - Container for a
mapwith 23 fields - Container for a
mapwith 24 fields - Container for a
mapwith 25 fields - Container for a
mapwith 26 fields - Container for a
mapwith 27 fields - Container for a
mapwith 28 fields - Container for a
mapwith 29 fields - Container for a
mapwith 30 fields - Container for a
mapwith 31 fields - Container for a
mapwith 32 fields - Container for a
mapwith 48 fields - Container for a
mapwith 64 fields - Iterator over existing values
Enums§
- Currently just
KeyNotFound