2 unstable releases

0.2.0 May 7, 2024
0.1.0 Jun 11, 2020

#557 in Data structures

Download history 8350/week @ 2024-07-23 8801/week @ 2024-07-30 6780/week @ 2024-08-06 6617/week @ 2024-08-13 6490/week @ 2024-08-20 5975/week @ 2024-08-27 6114/week @ 2024-09-03 8651/week @ 2024-09-10 7307/week @ 2024-09-17 9029/week @ 2024-09-24 8891/week @ 2024-10-01 7624/week @ 2024-10-08 5007/week @ 2024-10-15 6686/week @ 2024-10-22 6870/week @ 2024-10-29 7275/week @ 2024-11-05

26,839 downloads per month
Used in 11 crates (4 directly)

MIT/Apache

75KB
2K SLoC

sorted_vector_map

sorted_vector_map is an implementation of an ordered map and set (like std::collections::BTreeMap and std::collections::BTreeSet) using a sorted vector as the backing store.

Sorted vector maps are appropriate when data is frequently loaded from an ordered source, queried a small number of times, and infrequently modified through insertion or removal.

Loading from an ordered sequence is O(n) through an optimization to insert that handles in-order insertions specially. Extension of the sequence is also optimized, where extending a map or set of size n with m elements in a single operation is O(n + m log m). Otherwise, loading from an unordered sequence is O(n^2).

Look-up is O(log n) through binary search. Insertion and removal are both O(n), as are set operations like intersection, union and difference.

sorted_vector_map is part of rust-shed. See the rust-shed repository for more documentation, including the contributing guide.

License

sorted_vector_map is both MIT and Apache License, Version 2.0 licensed, as found in the LICENSE-MIT and LICENSE-APACHE files.

Dependencies

~1MB
~20K SLoC