cerdito

Crates.iocerdito
lib.rscerdito
version0.1.2
sourcesrc
created_at2024-07-09 19:01:42.601499
updated_at2024-08-03 02:26:08.203571
descriptionRust encoding and decoding framework
homepage
repositoryhttps://github.com/ikhomyakov/cerdito
max_upload_size
id1297392
size25,612
Igor Y. Khomyakov (ikhomyakov)

documentation

README

Rust encoding and decoding framework

This encoding and decoding framework is similar to serde but much smaller and simpler (hence its name, cerdito). It does not use an intermediary data model, does not utilize the visitor pattern, and does not support zero-copy decoding. However, it provides both synchronous and asynchronous APIs. This framework was implemented mainly to support rustbif—a compact binary format for encoding Rust data types.

TODOs

  • Fix enum tags: limit to positive numbers up to u32, allow const expressions in discriminators. Negative disriminators? Consider removing support for explicit variant discriminators.
  • Errors (remove unwraps and panics), figure out if need to insert ?;Ok(...) or return directly.
  • Decl macro for tuples.
  • [T; N] doesn't implement Default and user can't implement it either. Default is required when "new" program reads "old" data. Need to address it.
  • Implement Arr<bool, N>, Arr<char, N>, Arr<u8, N>, ..., Arr<u128, N>, Arr<i8, N>, ..., Arr<i128, N>, Arr<f32, N>, Arr<f64, N>, VArr, VArr, VArr, ..., VArr, VArr, ..., VArr, VArr, VArr; and Arr<T; N> (we need this to impl Default), VArr (this is the same as Vec, however, it is good to have a newtype in case we need to implement foreign trait).
  • Consider using Result<T, E> in your datastructures -- this is a transparent (or not?) wrapper that wont appear on the wire and that will only capture success/failure of sub-structure decoding. How to encode data that has Err()s?
  • Consider using attribute (default) to control compat behaviour at the runtime: when a field is missing, return Ok(default()) OR Error(); Or try to figure out if the type impl Default or not. Explicit attribute could be better, for example, the attr can also provide value for the default.
Commit count: 0

cargo fmt