Show HN: Hexi – Modern header-only network binary serialisation for C++
a year ago
- #Serialization
- #C++
- #Binary Data
- Hexi is a lightweight, header-only C++23 library for safely handling binary data, primarily from network sources.
- It supports protocols like DNS, STUN, NAT Port Mapping Protocol, and others, with a focus on ease of use, safety, and minimal overhead.
- Hexi does not offer versioning, format conversion, or text-based format handling.
- Dual-licensed under MIT and Apache License 2.0, allowing flexible usage.
- Easy integration into projects by copying hexi.h or using CMake.
- Primary classes: buffer_adaptor (wraps containers) and binary_stream (handles reading/writing).
- Supports bounds checking and error handling via exceptions or no_throw for zero runtime overhead.
- Endianness handling with hexi::endian for portable data serialization.
- String handling with adaptors like null_terminated for safe serialization.
- Includes extras like file_buffer, static_buffer, and dynamic_buffer for various use cases.
- Features like write seeking, fine-grained control with put/get, and zero-copy views into buffer data.