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: =
new_static;
// Dynamic, backed by alloc::vec::Vec<u8>:
let mut loader = new_dynamic;
// Dynamic can be resized. This invalidates the buffer.
loader.resize;
// Heap, backed by alloc::boxed::Box<[u8]>:
let mut loader = new_heap;
// 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.