small_sorted_set 1.0.1

A `SmallVec`-backed, sorted vec, with no duplicate elements
Documentation

small_sorted_set

small_sorted_set crate small_sorted_set documentation

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 serde feature is enabled, SmallSortedVec implements the serde::Serialize and serde::Deserialize traits.

See Also

  • smallvec - The backing vector type.
  • sdset - Fast set operations on sorted and deduplicated slices.
  • sorted-vec - Prior art. Backed by a std Vec instead of a SmallVec. (Psst: sorted-vec2 is actually less maintained than sorted-vec, despite what it claims...)