Expand description
§small_sorted_set
A SmallVec-backed, sorted vec, with no duplicate elements.
This is a type that is very comparable to a BTreeSet, but is all stored in a single, contiguous vector, instead of being split across a tree of separately allocated nodes. This makes it simpler and more cache friendly, improving performance of construction, ser/de, and reads. The tradeoff is that mutations may be slower, by virtue of requiring larger copies and reallocations.
Additionally, being backed by a SmallVec rather than a std Vec allows it to be automatically inlined on the stack for small numbers of elements, significantly improving performance for small collections.
§no_std support
This crate does not depend on std.
§MSRV
The minimum supported Rust version for this crate is 1.85, due to using edition 2024.
§Feature Flags
This crate has no default features.
- If the
serdefeature is enabled,SmallSortedVecimplements theserde::Serializeandserde::Deserializetraits.
§See Also
- smallvec - The backing vector type.
- sdset - Fast set operations on sorted and deduplicated slices.
- sorted-vec - Prior art. Backed by a std
Vecinstead of aSmallVec. (Psst:sorted-vec2is actually less maintained thansorted-vec, despite what it claims…)
Structs§
- Small
Sorted Set - A collection that guarantees its elements are always in sorted order, and that there are no duplicate elements.
Is stored inline on the stack for up to
Nelements, beyond which it automatically spills over to a heap allocation.