Expand description
Header buffer pool for zero-allocation header encoding.
Provides a pool of pre-allocated 11-byte header buffers that can be reused across frame sends to avoid per-frame allocations.
§Design
The pool uses thread-local storage with round-robin allocation:
- Each thread gets its own pool of 16 buffers
- No locking or atomic operations on the hot path
- Headers are overwritten in a circular fashion
§Usage
ⓘ
use procwire_client::protocol::header_pool::HeaderPool;
let mut pool = HeaderPool::new();
let buf = pool.acquire();
// Use buf for header encoding...§Note
Since Header::encode() already returns a stack-allocated [u8; 11],
the main benefit of this pool is for scenarios where you need to hold
multiple headers simultaneously or pass them across async boundaries.
Structs§
- Header
Pool - A pool of pre-allocated header buffers.
Functions§
- encode_
header_ pooled - Encode a header using the thread-local pool.
- with_
header_ pool - Access the thread-local header pool directly.