one-stack-vec 0.5.1

OneStackVec could contain any number of item like `Vec`, and it does heap allocation only when it contains more than one item.
Documentation
  • Coverage
  • 16.67%
    2 out of 12 items documented1 out of 10 items with examples
  • Size
  • Source code size: 10.78 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.8 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 19s Average build duration of successful builds.
  • all releases: 19s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • AtsukiTak

One-Stack-Vec

Overview

OneStackVec is simple data structure which contains any number of items. It does not heap allocation until there is one or zero item.

How to use

// Initialize
let mut items = OneStackVec::new();

// Adding
items.add(42);

// Getting
assert_eq!(Some(&42), items.get(0));

// Removing
assert_eq!(Some(&42), items.remove(0));
assert_eq!(None, items.get(0));