Easy out-of-the-box read and write strings in various formats using Deku
deku_string
is an utility crate for Deku that provides convenient support
for serializing and deserializing String and Vec in a variety of binary formats.
It handles UTF-8, UTF-16 and UTF-32 encoded strings and is suitable for parsing complex layouts.
✨ Features
- String support UTF-8, UTF-16 and UTF-32 support.
- Multiple layout formats, such as .Net, Pascal and zero-ended.
- Little and Big Endian support.
- Dynamic read and write without additional temporary structs and operations.
- No need to specify custom reader and writer.
- Compatible with Deku's derive macros and custom readers/writers.
- Supports serde via
serde
feature anddefmt
for embedded programming.
Supported plenty layout formats
- Fixed-length strings
- With or without zero-termination
- Pascal-style strings
- Length-prefixed strings having length size
u8
,u16
, oru32
- Length-prefixed strings having length size
- .NET length prefix
- Length-prefixed strings having length size
u32
7-bit encoded (like in .NET)
- Length-prefixed strings having length size
- C-style strings
- Zero-terminated strings
📦 Usage
Contributing
Contributions are welcome!
Whether you're fixing a bug, improving performance, adding support for new string formats, or just refining docs — your pull requests and suggestions are greatly appreciated.