pub struct GenericChunkedBuffer<const CHUNK_SIZE: usize> { /* private fields */ }
Expand description
A deque style buffer that can be written to and read from.
The buffer is composed of a series of fixed size chunks.
This structure is useful for memory constrained environments. It limits the size of contiguous allocations and incrementally releases memory as the buffer is consumed.
Example code:
use chunked_buffer::ChunkedBuffer;
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]);
Implementations§
Source§impl<const CHUNK_SIZE: usize> GenericChunkedBuffer<CHUNK_SIZE>
impl<const CHUNK_SIZE: usize> GenericChunkedBuffer<CHUNK_SIZE>
Trait Implementations§
Source§impl<const CHUNK_SIZE: usize> Default for GenericChunkedBuffer<CHUNK_SIZE>
impl<const CHUNK_SIZE: usize> Default for GenericChunkedBuffer<CHUNK_SIZE>
Auto Trait Implementations§
impl<const CHUNK_SIZE: usize> Freeze for GenericChunkedBuffer<CHUNK_SIZE>
impl<const CHUNK_SIZE: usize> RefUnwindSafe for GenericChunkedBuffer<CHUNK_SIZE>
impl<const CHUNK_SIZE: usize> Send for GenericChunkedBuffer<CHUNK_SIZE>
impl<const CHUNK_SIZE: usize> Sync for GenericChunkedBuffer<CHUNK_SIZE>
impl<const CHUNK_SIZE: usize> Unpin for GenericChunkedBuffer<CHUNK_SIZE>
impl<const CHUNK_SIZE: usize> UnwindSafe for GenericChunkedBuffer<CHUNK_SIZE>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more