| Crates.io | one-stack-vec |
| lib.rs | one-stack-vec |
| version | 0.5.1 |
| created_at | 2017-06-12 10:49:46.31483+00 |
| updated_at | 2017-06-22 15:50:43.927476+00 |
| description | OneStackVec could contain any number of item like `Vec`, and it does heap allocation only when it contains more than one item. |
| homepage | https://github.com/AtsukiTak/one-stack-vec |
| repository | https://github.com/AtsukiTak/one-stack-vec |
| max_upload_size | |
| id | 18703 |
| size | 8,128 |
OneStackVec is simple data structure which contains any number of items. It does not heap allocation until there is one or zero item.
// 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));