Crates.io | nibblet |
lib.rs | nibblet |
version | 0.1.0 |
created_at | 2025-06-08 03:59:12.588549+00 |
updated_at | 2025-06-08 03:59:12.588549+00 |
description | Byte-focussed alternative ser/de derives |
homepage | |
repository | https://github.com/TheMikeste1/discrimin-ant |
max_upload_size | |
id | 1704593 |
size | 73,377 |
Nibblet is a byte-focussed alternative ser/de derive
s.
Serde is a fantastic library for serializing data into multiple formats, including
binary formats such as bincode and postcard.
However, the default serialize and deserialize derive
s in Serde make cross-application/language use of these formats difficult.
Examples:
repr
for an enumserialize_*_variant
(the serialize methods for enums)
This crate attempts to resolve these issues by providing alternative Serialize
and Deserialize
derive
s.
These derive
s are specifically designed to work with binary formats, and may not be compatible with other formats.
To use these alternative derive
s, just use the nibblet
versions instead of the serde
versions:
use discrimin_ant_proc::discriminant;
use nibblet::Serialize;
#[derive(Serialize)]
#[discriminant(u8)] // Enums must provide a discriminant implementation
enum FieldTypes {
Unit,
Newtype(u8),
Unnamed(u8, u16),
Field{ a: u8, b: u16 },
}