#heap #heap-allocation #items #removing #numbers #at-least-one

alo

ALO means At Least One. It could contain any number of item like Vec but it does not heap allocation if it contains only one item

3 releases (breaking)

Uses old Rust 2015

0.3.0 Jun 10, 2017
0.2.1 Jun 6, 2017
0.1.0 Jun 5, 2017

#2333 in Data structures

MIT/Apache

7KB
176 lines

ALO

Overview

ALO means "At Least One". ALO is simple data structure which contains at least one items. ALO does not heap allocation until there is only one item.

How to use

// Initialize
let mut alo = ALO::with_item(42);

// Adding
alo.add(777);
alo.add(0);

// Removing
assert_eq!(Some(&42), alo.remove(0));

// Getting
assert_eq!(Some(&777), alo.get(0));

No runtime deps