| Crates.io | solana-bytes-reader |
| lib.rs | solana-bytes-reader |
| version | 0.2.1 |
| created_at | 2025-07-23 19:26:05.996042+00 |
| updated_at | 2025-07-25 22:41:53.919707+00 |
| description | Utility library for bytes reinterpretation. |
| homepage | |
| repository | https://github.com/ibg101/solana-bytes-reader |
| max_upload_size | |
| id | 1765174 |
| size | 34,050 |
A lightweight, ergonomic utility library for safely and efficiently reading bytes slices, primarily designed for Solana program development.
This crate provides basic primitives for reading various integer types, booleans, and fixed-size byte arrays from raw byte slices with offset tracking.
u8, i8, u16, i16, u32, i32, u64, i64).bytemuck feature.ReadBytes) and peeking (PeekIntoBytes) without advancing the offset.Add to your Cargo.toml:
# Enables basic features (by default)
solana-bytes-reader = "0.2.0"
# Enables `bytemuck` feature (disabled by default)
solana-bytes-reader = { version = "0.2.0", features = ["bytemuck"] }
Initialize a Reader with a byte slice and use the provided methods to parse data sequentially or peek into upcoming bytes without consuming them.
use solana_bytes_reader::{Reader, ReadBytes};
let data: &[u8] = /* your byte slice */;
let mut reader: Reader = Reader::new(data);
let value: u32 = reader.read_u32()?;
let flag: bool = reader.read_bool()?;
// ...