no_std-friendly, memory-backed buffer toolkit designed for Sans-I/O style encoding and decoding.
Provides Chunk (read-only view), ChunkMut (mutable view), and helpers for explicit, convenient bounds-checked access.
Overview
buffo is a small, focused toolkit for working with in-memory buffers in a predictable, controlled way.
It’s Sans-I/O friendly — meaning it’s easy to integrate into network protocol parsers, database engines, binary file format decoders/encoders, and embedded systems that follow the Sans-I/O design pattern — but it doesn’t implement any I/O itself.
Features
- Predictable memory usage – operates directly on memory you provide, no hidden allocations.
- Explicit error handling – choose panicking,
Option, or detailedResultwith requested vs. available byte counts. - Segmented views – create independent
Chunk/ChunkMutviews into the same buffer. - Offset reads/writes – operate at arbitrary positions without unsafe pointer math.
- Non-destructive cursors –
Peeker,RefPeeker, andPuttermaintain independent positions for look-ahead parsing and transactional writes. - LEB128 varint support – built-in variable-length integer encoding/decoding via
varing. - Embedded friendly –
no_std&no_allocready, works in embedded and constrained environments. - Retry-friendly –
try_*methods enable robust partial read/write handling.
Installation
[]
= "0.9"
Feature Flags
| Feature | Default? | Description |
|---|---|---|
std |
Yes | Enables std integration |
alloc |
No | Enables heap-allocated buffer support |
bytes_1 |
No | Enable integration with bytes 1.x |
smol_bytes_01 |
No | Enable integration with smol-bytes 0.1.x |
smol_bytes_02 |
No | Enable integration with smol-bytes 0.2.x |
smol_bytes_01 and smol_bytes_02 can be enabled together. The existing
to_smol_bytes / to_smol_bytes_mut conversions return the 0.1 types, while
the version-qualified to_smol_bytes_02 / to_smol_bytes_mut_02 conversions
return the 0.2 types. buffo 0.9 requires Rust 1.95 or newer.
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
buffo 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.