Expand description


A small table map with a byte sized key index.

With a key type which all invariants can be represented as unique bytes, searching this map is a single index dereference. With only a few bytes it is still very efficient.


The API is a similar subset to HashMap, containing the same insert, get, and entry functions:

fn max_char(chars: &str) -> (char, usize)
    let mut map = Map::new();
    for x in chars.chars() {
	    *map.entry(x).or_insert(0usize) += 1;	
    map.into_iter().max_by_key(|&(_, v)| v).unwrap_or_default()

Use cases

Designed for instances where you want a small map with small key types. Performance greately outpaces complex hash-based maps in these cases.

When not to use

Generally don’t use this if your key would have a lot of collisions being represents in 8 bits, otherwise it might be a faster alternative to hash-based maps. You should check yourself before sticking with this crate instead of std’s vectorised map implementations.


pub use entry::Entry;
pub use primitive::Primitive;


Map entries.

Iterator types for Map

Contains Collapse impls for primitive types through a newtype shim.

Space-efficient small maps and sets


A helper macro for creating Map instances with or without pre-set entries.


A small hashtable-like map with byte sized key indecies.

A single page in a Map. Contains up to 256 key-value entries.


Trait for types that can be used as Map keys.


Collapse a slice of bytes with an XOR fold

Collapse an iterator of bytes with an XOR fold

Type Definitions

A smallmap set.