freeze 0.1.1

A mmap-backed bump allocator that allows compact and zero-realloc mutability of the top vector.
Documentation
  • Coverage
  • 37.5%
    6 out of 16 items documented0 out of 15 items with examples
  • Size
  • Source code size: 12.51 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 850.45 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • Adam-Vandervorst/Freeze
    0 2 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Adam-Vandervorst

Freeze

Currently, provides a simple bump-allocator that allows the top vector to be temporarily mutable, before being frozen as the new vector is allocated.

let mut alloc = BumpAllocRef::new();

let s1: &[u8] = {
    let mut v1: LiquidVecRef = alloc.top();
    v1.extend_from_slice(&[1, 2, 3]);
    v1.extend_one(4);
    v1.extend_from_within(..3);
    v1.deref_mut().reverse();
    v1.pop();
    v1.freeze()
};

assert_eq!(s1, [3, 2, 1, 4, 3, 2]);

let s2: &[u8] = {
    let mut v1: LiquidVecRef = alloc.top();
    v1.extend_from_slice(&[10, 20, 30]);
    v1.extend_one(40);
    v1.extend_from_within(..3);
    v1.deref_mut().reverse();
    v1.pop();
    v1.freeze()
};

assert_eq!(s2, [30, 20, 10, 40, 30, 20]);
assert_eq!(alloc.data_size(), (s1.len() + s2.len()));