stackvector

Crates.iostackvector
lib.rsstackvector
version1.1.1
sourcesrc
created_at2018-12-07 09:33:26.406626
updated_at2021-04-19 15:30:14.79865
descriptionStackVec: vector-like facade for stack-allocated arrays.
homepage
repositoryhttps://github.com/Alexhuszagh/rust-stackvector
max_upload_size
id100578
size66,880
Alexander Huszagh (Alexhuszagh)

documentation

https://docs.rs/stackvector

README

rust-stackvector

Documentation

Release notes

"StackVec": vector-like facade for stack-allocated arrays.

Comparison to ArrayVec

ArrayVec is a relatively mature stack vector implementation, using a backing array like stackvector. The main differences between ArrayVec and StackVec are in the compatibility with Vec's API, as well as the ease-of-creation.

Compatibility with Vec's API

ArrayVec includes numerous modifications from Vec's API, effectively requiring a wrapper to use it analogously to Vec. In certain situations, the extra functionality is desirable (for example, ArrayVec has push, which panics if the container exceeds the array's bounds, try_push, and push_unchecked, while stackvector only has push). In other cases, ArrayVec is missing numerous methods that simplify working with Vec. For example, ArrayVec is missing:

  1. Deduplication (dedup, dedup_by, dedup_by_key).
  2. Insert many elements (insert_many) (Non-standard).

Likewise, stackvector is missing certain convenience methods that are not present in Vec:

  1. Stack-allocated array is full (is_full).
  2. Dispose without dropping (dispose).

Version Support

Both ArrayVec and stackvector have support for Rustc versions as old as 1.20.0.

License

StackVector is derived from Servo's smallvec, and like smallvec, it is dual licensed under either the MIT or Apache 2.0 license.

Version Support

Stackvector has been tested on version of Rustc as low as 1.36.0 (needed for mem::MaybeUninit).

Commit count: 22

cargo fmt