load-buffer 1.0.0

Crate for loading data into a fixed-sized buffer. Similar to BufRead, but allowing static or dynamic sizes, and no_std use.
Documentation
  • Coverage
  • 63.64%
    7 out of 11 items documented1 out of 10 items with examples
  • Size
  • Source code size: 29.81 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 597.99 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Taywee

load-buffer

Simple Rust crate for loading data into a fixed-sized buffer. Similar to BufReader, but allowing static or dynamic buffers, and no_std use.

To use this, you'll need to implement Load for your type (std::io::Read types automatically implement this), then load it into a BufferedLoader:

// Static, backed by the array size you give it:
let mut loader: BufferedLoader<[u8; 64], _> =
    BufferedLoader::new_static(Loader::default());
// Dynamic, backed by alloc::vec::Vec<u8>:
let mut loader = BufferedLoader::new_dynamic(Loader::default(), 64);
// Dynamic can be resized.  This invalidates the buffer.
loader.resize(268435456);
// Heap, backed by alloc::boxed::Box<[u8]>:
let mut loader = BufferedLoader::new_heap(Loader::default(), 268435456);
// Heap can not be resized, but will not fill the stack for huge sizes.

// You can also supply your own buffer type, as long as it implements
// AsRef<[u8]> + AsMut<[u8]> + Debug.