Skip to main content

Module sorted_vec_map

Module sorted_vec_map 

Source
Expand description

SortedVecMap<K, V> — small-to-medium sealed sorted map.

Sorted Vec<(K, V)> with binary-search lookup. The “graduation” of TinyDetMap for sizes ~16–~10_000 where BTreeMap’s pointer-chasing cost outweighs Vec’s contiguous-memory wins.

Iteration is sorted by K, so output is canonical. Iteration cost is O(n); lookup is O(log n). Insert/remove cost is O(n) (shift), so this is not the structure for hot mutation paths.

Two construction modes:

  • insert one-by-one — O(n²) total, fine for sealed/build-once.
  • from_sorted_uniqueO(n), caller has already sorted.

Structs§

SortedVecMap