vector-growing 0.1.0

The growing vector with free indexes.
Documentation
  • Coverage
  • 72.73%
    8 out of 11 items documented4 out of 10 items with examples
  • Size
  • Source code size: 21.6 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 235.0 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • MayorDi/vector-growing
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • MayorDi

VecGrow

It is similar to a regular Vec, with one exception - the size is not reduced. VecGrow can constantly grow, but not decrease, and when objects are deleted, their place remains for the new object as a free index, which eases the memory power in the case of permanent deletion and creation of objects.

Examples

use vector_growing::*;

let mut vg = VecGrow::new();
vg.push(1);
vg.push(2);

assert_eq!(vg[0], Some(1));
assert_eq!(vg[1], Some(2));

vg.remove(0);

assert_eq!(vg[0], None);

vg.push(1);

assert_eq!(vg[0], Some(1));

Initializing VecGrow using a macro:

use vector_growing::*;

let vg_empty: VecGrow<u8> = vec_grow![];
let vg_num = vec_grow![1, 2, 3];
let vg_zero = vec_grow![0; 100];

assert!(vg_empty.is_empty());
assert_eq!(vg_num[1], Some(2));
assert_eq!(vg_zero[99], Some(0));