chunked-buffer 0.2.0

A chunked buffer for memory constrained systems
Documentation
  • Coverage
  • 78.57%
    11 out of 14 items documented1 out of 11 items with examples
  • Size
  • Source code size: 28.03 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.33 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • devrandom01/chunked-buffer
    0 1 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • devrandom

Chunked Buffer

A deque style buffer backed by non-contiguous chunks of memory.

The buffer grows incrementally without re-allocations and can also be consumed incrementally, releasing memory as it is consumed.

This structure is useful for memory constrained environments. It limits the size of contiguous allocations and incrementally releases memory as the buffer is consumed.

Supports no_std environments with alloc.

Usage

use chunked_buffer::ChunkedBuffer;

fn doit() { 
    let mut buf = ChunkedBuffer::new();
    buf.write(&[1, 2, 3]);
    let mut dest = [0; 10];
    let n = buf.read(&mut dest);
    
    assert_eq!(n, 3);
    assert_eq!(dest, [1, 2, 3, 0, 0, 0, 0, 0, 0, 0]);
}