Small vectors in various sizes. These store a certain number of elements inline, and fall back to the heap for larger allocations. This can be a useful optimization for improving cache locality and reducing allocator traffic for workloads that fit within the inline buffer.
smallvec does not depend on
std. However, the optional
write feature implements the
std::io::Write trait for vectors of
When this feature is enabled,
smallvec depends on
union feature is enabled
smallvec will track its state (inline or spilled)
without the use of an enum tag, reducing the size of the
smallvec by one machine word.
This means that there is potentially no space overhead compared to
smallvec can still be larger than
Vec if the inline buffer is larger than two
To use this feature add
features = ["union"] in the
smallvec section of Cargo.toml.
Note that this feature requires a nightly compiler (for now).
An iterator that removes the items from a
An iterator that consumes a
Types that can be used as the backing store for a SmallVec
Trait to be implemented by a collection that can be extended from a slice