#succinct #vector #array #smallvec


Rust collections that are newtype wrappers around smallvec

16 releases

new 0.3.5 Feb 23, 2021
0.3.4 Dec 15, 2020
0.3.3 Nov 1, 2020
0.2.8 Oct 17, 2020
0.1.1 Nov 6, 2019

#145 in Data structures

Download history 444/week @ 2020-11-07 113/week @ 2020-11-14 22/week @ 2020-11-21 52/week @ 2020-11-28 91/week @ 2020-12-05 229/week @ 2020-12-12 31/week @ 2020-12-19 18/week @ 2020-12-26 286/week @ 2021-01-02 26/week @ 2021-01-09 62/week @ 2021-01-16 44/week @ 2021-01-23 19/week @ 2021-01-30 94/week @ 2021-02-06 171/week @ 2021-02-13 190/week @ 2021-02-20

411 downloads per month
Used in negatable-set



Vec-collections   Build Status Latest Version Docs Badge


This crate provides collections (sets and maps) that wrap SmallVec.

Use cases

Small collections

It happens very frequently that you have collections that have on average just a very small number of elements. If you know the maximum size or even the maximum typical size in advance, you can use this crate to store such collections without allocations. For a larger number of elements, the underlying SmallVec will allocate the elements on the heap as a single allocation.

Read-heavy collections

Another very frequent pattern is that you have a possibly large collection that is being created once and then used readonly for a long time. E.g. lookup tables. In these cases, ease of adding individual new elements is less important than compact in-memory representation and lookup performance. This crate provides succinct collections that have only a very small constant overhead over the contents of the collections.


Performance for bulk creation as well as lookup is better than BTreeMap/BTreeSet and comparable with HashMap/HashSet for types with a cheap Ord instance, like primitive types, and small to medium sizes. Performance for insertion or removal of individual elements to/from large collections is bad, however. This is not the intended use case.

Collections overview


Provides a set backed by a SmallVec of elements.


Provides a map backed by a SmallVec of key value pairs.


A VecSet with an additional flag so it can support negation. This way it is possible to represent e.g. the set of all u64 except 1.


A VecMap with an additional default value, so lookup is a total function.


The in place operations use unsafe code. If that is a problem for you, let me know and I can hide them behind a feature.


~11K SLoC