ChunkedVec
Note: This is a learning project implementing a chunk-oriented vector collection with fixed-size chunk storage.
ChunkedVec is a chunk-oriented vector collection built around fixed-size chunk storage. It keeps familiar vector-style operations for individual elements while also exposing chunk-aware APIs for traversing and processing data chunk by chunk.
Features
- Fixed-size chunk storage with compile-time or default chunk sizing
- Chunk-oriented APIs such as
chunk,first_chunk,last_chunk, anditer_chunks - Familiar vector-style interface with efficient element access and mutation
- Support for both fixed-size and default-size chunk construction
- O(1) random access time complexity
- Efficient memory allocation during growth
- Support for constructing from various types (Vec, Array, Slice, Iterator)
Usage Examples
Basic Usage with Default Chunk Size
use ChunkedVec;
Using Macro for Quick Initialization
use ;
Using Fixed Chunk Size
use ;
Chunk-Oriented Access
use ;
Converting from Other Collections
use ChunkedVec;
Current Implementation Status
Implemented Features
- Comprehensive constructors (
new,with_capacity,with_chunk_count) - Push operation (supports all types)
- Index-based access (
get,get_mut,Index/IndexMuttraits) - Chunk-oriented access (
chunk_size,chunk_count,chunk,chunk_mut,first_chunk,last_chunk) - Chunk iterators (
iter_chunks,iter_chunks_mut) - Length and capacity queries (
len,capacity,allocated_capacity) - Fixed-size chunk support via
ChunkedVecSized - From/FromIterator implementations for various types
- Safe and unsafe getter methods
- Efficient memory management
Planned Features
- Broader collection API coverage
- Custom allocator support
- More collection traits implementation
- Performance optimizations for specific use cases
Contributing
This is an open learning project. Contributions and suggestions are welcome! Feel free to:
- Report bugs and suggest features
- Submit pull requests
- Share your use cases and feedback
- Help improve documentation