one-stack-vec

Crates.ioone-stack-vec
lib.rsone-stack-vec
version0.5.1
sourcesrc
created_at2017-06-12 10:49:46.31483
updated_at2017-06-22 15:50:43.927476
descriptionOneStackVec could contain any number of item like `Vec`, and it does heap allocation only when it contains more than one item.
homepagehttps://github.com/AtsukiTak/one-stack-vec
repositoryhttps://github.com/AtsukiTak/one-stack-vec
max_upload_size
id18703
size8,128
Atsuki Takahashi (AtsukiTak)

documentation

README

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));
Commit count: 0

cargo fmt