https://github.com/andogq/cuisiner
Cook up some conversions to and from C-style binary layouts.
https://github.com/andogq/cuisiner
binary-encoding binary-format rust rust-crate serialization zerocop
Last synced: 4 months ago
JSON representation
Cook up some conversions to and from C-style binary layouts.
- Host: GitHub
- URL: https://github.com/andogq/cuisiner
- Owner: andogq
- License: apache-2.0
- Created: 2025-03-18T07:37:00.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-30T11:15:05.000Z (about 1 year ago)
- Last Synced: 2025-03-30T11:22:09.441Z (about 1 year ago)
- Topics: binary-encoding, binary-format, rust, rust-crate, serialization, zerocop
- Language: Rust
- Homepage:
- Size: 79.1 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# cuisiner
***Cook up some conversions to and from C-style binary layouts.***
Cuisiner provides traits and macros to create idiomatic Rust structures that can be seamlessly
converted to and from C-style binary representations, even if it has a different layout.
## Overview
Cuisiner centres on the derivable `Cuisiner` trait, which provides the 'raw' serialised type (via
the `Raw` associated type), and methods used to serialise and deserialise from the raw value. The
raw representation must align with the C representation of the structure, whilst the `try_from_raw`
and `try_to_raw` methods can handle validation when converting to and from the idiomatic Rust
representation.
## Example
See [`sqlite-header.rs`](./tests/sqlite-header.rs) for an example.
## Todo
- [ ] Mirror `zerocopy`'s API for reading to/from bytes (`read_prefix`, `read_suffix`, etc)
- [ ] Add support for reading from `Readable`