Expand description
bufkit
Providing Buf and BufMut for working with byte buffers. bufkit focuses on predictable memory usage and comprehensive error handling.
§Features
bufkit prioritizes explicit control and detailed error reporting, making it suitable for applications where memory behavior must be predictable and errors need comprehensive handling.
- Multiple error handling strategies - Choose between panicking,
Option, or detailedResulttypes - Buffer segmentation - Create independent views of buffer data
- Offset operations - Built-in methods for writing/reading at specific positions
- Embedded friendly - Support both
no-allocandno-std. - Sans-I/O friendly - Works purely on memory buffers without hidden allocations or I/O operations, providing predictable behavior and detailed error information that helps with protocol state management and partial data handling
- No hidden allocations - Write operations work directly on provided memory
- Retry-friendly -
try_*methods provide detailed error information (requested vs available bytes) enabling robust retry logic and graceful error recovery
§Installation
[dependencies]
bufkit = "0.3"-
Enable LEB128 encoding/decoding methods
[dependencies] bufkit = { version = "0.3", features = ["varing"] }
§Alternatives
bytes::{Buf, BufMut}: Buffer traits for the bytes may or may not be stored in contiguous memory.buffer-trait: ABuffertrait for reading into uninitialized buffers.
§License
bufkit is under the terms of both the MIT license and the
Apache License (Version 2.0).
See LICENSE-APACHE, LICENSE-MIT for details.
Copyright (c) 2025 Al Liu.
Modules§
- error
- Errors buffer I/O
Structs§
- Peeker
- A peeker for reading from a buffer without advancing the original buffer’s cursor.
- Putter
- A putter for writing to a buffer without modifying the original buffer’s cursor.
- RefPeeker
- A peeker for reading from a buffer without advancing the original buffer’s cursor.
- Write
Buf - A wrapper around any type that implements
BufMutfor improved ergonomics in generic code.
Traits§
- Buf
- A trait for implementing custom buffers that can read and navigate through byte sequences.
- BufExt
- Extension trait for
Bufthat provides additional methods - BufMut
- A trait for implementing custom buffers that can store and manipulate byte sequences.
- BufMut
Ext - A trait that extends
BufMutwith additional methods. - Varint
varing - A trait for types that can be encoded as variable-length integers (varints).