| Crates.io | bytecord |
| lib.rs | bytecord |
| version | 0.0.2 |
| created_at | 2025-04-15 01:10:43.412998+00 |
| updated_at | 2025-04-16 17:25:42.410983+00 |
| description | A byte reading-building utility library |
| homepage | https://github.com/iizudev/bytecord |
| repository | https://github.com/iizudev/bytecord |
| max_upload_size | |
| id | 1633805 |
| size | 76,198 |
A lightweight utility library for reading and building binary data with alignment.
Add this library to your project by:
cargo add bytecord
reading:
use bytecord::ByteCord;
let data = vec![0u8; 1024];
let cord = ByteCord::new(data);
// Read with 4-byte alignment
let mut reader = cord.read_with_alignment(4);
let a = cord.next_be_u32().unwrap();
let b = cord.next_n(a).unwrap();
building:
use bytecord::ByteCordBuilder;
// a new builer with alignment of 1 byte (meaning no alignment)
let mut data = ByteCordBuilder::new(1);
data.append_le_u32(1111);
data.append_u8(1);
data.append_le_i64(-3919);
let slice = data.into_boxed_slice();
This project is dual-licensed under: