https://github.com/stackdoubleflow/binde
A crate for deserialiazing binary structures with ease
https://github.com/stackdoubleflow/binde
Last synced: over 1 year ago
JSON representation
A crate for deserialiazing binary structures with ease
- Host: GitHub
- URL: https://github.com/stackdoubleflow/binde
- Owner: StackDoubleFlow
- License: mit
- Created: 2022-02-20T22:29:22.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2022-07-05T06:33:09.000Z (about 4 years ago)
- Last Synced: 2025-02-01T12:27:43.487Z (over 1 year ago)
- Language: Rust
- Size: 8.79 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Binary Deserialize
A crate for deserialiazing binary structures with ease.
Heads Up! This is a very experimental library with no support for alignment and little documentation; use with caution.
```toml
binde = { git = "https://github.com/StackDoubleFlow/binde" }
```
# Example
```rust
use binde::{BinaryDeserialize, LittleEndian, deserialize};
use std::io::Cursor;
#[derive(BinaryDeserialize, Debug, PartialEq, Eq)]
struct CoolStructure {
a: u16,
b: i8,
}
fn main() {
assert_eq!(binde::size_of::(), 3)
let cursor = Cursor::new([0xDF, 0x27, 0x95]);
let cool_structure: CoolStructure = deserialize::(cursor).unwrap();
assert_eq!(cool_structure, CoolStructure { a: 10207, b: -107 })
}
```