| Crates.io | deku_string |
| lib.rs | deku_string |
| version | 0.4.0 |
| created_at | 2025-04-11 16:13:42.927222+00 |
| updated_at | 2025-09-03 17:05:30.145761+00 |
| description | Encoding/decoding helpers for Deku, String, Vec in fixed, Pascal, .NET and C-style formats with length guarantee. |
| homepage | |
| repository | https://github.com/eirtools/deku_string |
| max_upload_size | |
| id | 1629996 |
| size | 225,723 |
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.
serde feature and defmt for embedded programming.u8, u16, or u32u32 7-bit encoded (like in .NET)#[derive(Default, Debug, Clone, PartialEq, PartialOrd, deku::DekuRead, deku::DekuWrite)]
#[deku(endian = "little")]
struct SampleModel {
#[deku(ctx = "Encoding::Utf8, StringLayout::fixed_length(10)")]
fixed_value: StringDeku,
// Vector of strings, each of them have their own layout.
#[deku(ctx = "VecLayout::LengthPrefix(Size::U32_7Bit), (Encoding::Utf8, StringLayout::LengthPrefix(Size::U8))")]
vec_of_strings: VecDeku<StringDeku>
// Read u8 into vector to the end.
#[deku(ctx = "VecLayout::FixedSize(10)")]
vec: VecDeku<u8>,
}
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.