stable-vec 0.1.1

A Vec-like collection which guarantees stable indices and features O(1) deletion of elements
Documentation
extern crate stable_vec;

use stable_vec::StableVec;


fn main() {
    let mut sv = StableVec::new();
    sv.push('a');
    let b = sv.push('b');
    let c = sv.push('c');
    sv.push('d');
    sv.push('e');
    let f = sv.push('f');
    sv.push('g');

    sv.remove(b);
    sv.remove(c);
    sv.remove(f);


    println!("--- before compact():");
    for i in 0..sv.next_index() {
        println!("{} -> {:?}", i, sv.get(i));
    }

    let n_before_compact = sv.num_elements();

    sv.compact();
    println!("--- after compact():");
    for i in 0..sv.next_index() {
        println!("{} -> {:?}", i, sv.get(i));
    }

    println!("compact:  {}", sv.is_compact());
    println!("n before: {}", n_before_compact);
    println!("n after:  {}", sv.num_elements());
}