#map #key-set #set #vec #key-hash #vector #no-std

no-std vecmap-rs

A vector-based map and set implementation

18 releases

0.2.1 Jan 3, 2024
0.2.0 Dec 25, 2023
0.1.15 Dec 23, 2023
0.1.12 Sep 19, 2023
0.1.8 Oct 30, 2022

#165 in Data structures

Download history 1552/week @ 2024-01-01 1318/week @ 2024-01-08 1566/week @ 2024-01-15 1602/week @ 2024-01-22 1827/week @ 2024-01-29 1449/week @ 2024-02-05 1336/week @ 2024-02-12 1621/week @ 2024-02-19 1249/week @ 2024-02-26 1487/week @ 2024-03-04 1335/week @ 2024-03-11 1404/week @ 2024-03-18 1330/week @ 2024-03-25 1561/week @ 2024-04-01 1533/week @ 2024-04-08 2623/week @ 2024-04-15

7,151 downloads per month
Used in 36 crates (3 directly)

MIT/Apache

135KB
2K SLoC

vecmap-rs

Build Status crates.io docs.rs License: Apache 2.0 License: MIT

A vector-based ordered map and set implementation with zero dependencies and support for #![no_std].

Map keys are not required to be hashable and do not need to form a total order. Therefore, VecMap<K, V> and VecSet<T> can be used with key types which neither implement Hash nor Ord.

Since vecmap-rs is a Vec<(K, V)> under the hood, worst case lookup and insertion performance is O(n) and scales with the number of map entries. Thus, its main use case are small collections with unhashable keys.

For key types that implement Hash and Ord consider using a map or set implementation with better performance such as HashMap/HashSet and BTreeMap/BTreeSet from the standard library or popular alternatives like IndexMap/IndexSet.

Cargo features

The following features are available:

  • serde: Provides Serialize and Deserialize implementations for VecMap and VecSet. This feature is disabled by default. Enabling it will pull in serde as a dependency.

License

The source code of vecmap-rs is licensed under either of Apache License, Version 2.0 or MIT license at your option.

Dependencies

~185KB