All Projects → sharksforarms → Deku

sharksforarms / Deku

Licence: other
Declarative binary reading and writing: bit-level, symmetric, serialization/deserialization

Programming Languages

rust
11053 projects
declarative
70 projects

Projects that are alternatives of or similar to Deku

bytes
Work with bytes and implement network protocols
Stars: ✭ 77 (-43.38%)
Mutual labels:  serialization, bytes, deserialization
json struct
json_struct is a single header only C++ library for parsing JSON directly to C++ structs and vice versa
Stars: ✭ 279 (+105.15%)
Mutual labels:  serialization, parse, deserialization
jzon
A correct and safe JSON parser.
Stars: ✭ 78 (-42.65%)
Mutual labels:  serialization, deserialization, encoder-decoder
Yaxlib
Yet Another XML Serialization Library for the .NET Framework and .NET Core
Stars: ✭ 124 (-8.82%)
Mutual labels:  serialization, deserialization
Restfulsense
A RESTFul operations client that serializes responses and throws meaningful exceptions for >= 400 status codes.
Stars: ✭ 28 (-79.41%)
Mutual labels:  serialization, deserialization
Beeschema
Binary Schema Library for C#
Stars: ✭ 46 (-66.18%)
Mutual labels:  serialization, deserialization
Marshmallow
A lightweight library for converting complex objects to and from simple Python datatypes.
Stars: ✭ 5,857 (+4206.62%)
Mutual labels:  serialization, deserialization
Yyjson
The fastest JSON library in C
Stars: ✭ 1,894 (+1292.65%)
Mutual labels:  serialization, deserialization
Java
jsoniter (json-iterator) is fast and flexible JSON parser available in Java and Go
Stars: ✭ 1,308 (+861.76%)
Mutual labels:  serialization, deserialization
Pyjson tricks
Extra features for Python's JSON: comments, order, numpy, pandas, datetimes, and many more! Simple but customizable.
Stars: ✭ 131 (-3.68%)
Mutual labels:  serialization, deserialization
Borer
Efficient CBOR and JSON (de)serialization in Scala
Stars: ✭ 131 (-3.68%)
Mutual labels:  serialization, deserialization
Jackson Module Kotlin
Module that adds support for serialization/deserialization of Kotlin (http://kotlinlang.org) classes and data classes.
Stars: ✭ 830 (+510.29%)
Mutual labels:  serialization, deserialization
Iod
Meta programming utilities for C++14. Merged in matt-42/lithium
Stars: ✭ 731 (+437.5%)
Mutual labels:  serialization, deserialization
Go
A high-performance 100% compatible drop-in replacement of "encoding/json"
Stars: ✭ 10,248 (+7435.29%)
Mutual labels:  serialization, deserialization
Bluecap
iOS Bluetooth LE framework
Stars: ✭ 669 (+391.91%)
Mutual labels:  serialization, deserialization
Awesome Python Models
A curated list of awesome Python libraries, which implement models, schemas, serializers/deserializers, ODM's/ORM's, Active Records or similar patterns.
Stars: ✭ 124 (-8.82%)
Mutual labels:  serialization, deserialization
Loopback Component Jsonapi
JSONAPI support for loopback.
Stars: ✭ 104 (-23.53%)
Mutual labels:  serialization, deserialization
Typical
Typical: Fast, simple, & correct data-validation using Python 3 typing.
Stars: ✭ 111 (-18.38%)
Mutual labels:  serialization, deserialization
Lora Serialization
LoraWAN serialization/deserialization library for The Things Network
Stars: ✭ 120 (-11.76%)
Mutual labels:  serialization, deserialization
Fasteasymapping
A tool for fast serializing & deserializing of JSON
Stars: ✭ 556 (+308.82%)
Mutual labels:  serialization, deserialization

Deku

Latest Version Rust Documentation Actions Status codecov Gitter

Declarative binary reading and writing

This crate provides bit-level, symmetric, serialization/deserialization implementations for structs and enums

Why use Deku

Productivity: Deku will generate symmetric reader/writer functions for your type! Avoid the requirement of writing redundant, error-prone parsing and writing code for binary structs or network headers

Usage

[dependencies]
deku = "0.11"

no_std:

[dependencies]
deku = { version = "0.11", default-features = false, features = ["alloc"] }

Example

See documentation or examples folder for more!

Read big-endian data into a struct, modify a value, and write it

use deku::prelude::*;

#[derive(Debug, PartialEq, DekuRead, DekuWrite)]
#[deku(endian = "big")]
struct DekuTest {
    #[deku(bits = "4")]
    field_a: u8,
    #[deku(bits = "4")]
    field_b: u8,
    field_c: u16,
}

fn main() {
    let data: Vec<u8> = vec![0b0110_1001, 0xBE, 0xEF];
    let (_rest, mut val) = DekuTest::from_bytes((data.as_ref(), 0)).unwrap();
    assert_eq!(DekuTest {
        field_a: 0b0110,
        field_b: 0b1001,
        field_c: 0xBEEF,
    }, val);

    val.field_c = 0xC0FE;

    let data_out = val.to_bytes().unwrap();
    assert_eq!(vec![0b0110_1001, 0xC0, 0xFE], data_out);
}

Changelog

See CHANGELOG.md

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].