bytes_to_type
A Rust library for converting slices of bytes to vectors of a specific type.
About
bytes_to_type allows you to conveniently convert slices of byte data into vectors of a specific type, handling necessary conversions and memory alignment seamlessly.
Key Features
- Type Conversion: Easily convert slices of bytes into vectors of a specified type.
- Memory Safety: Ensures that conversions maintain Rust’s guarantees of memory safety.
Getting Started
Installation
Add bytes_to_type to your Cargo.toml file:
[]
= "0.1.1"
Example
use bytes_to_type;
// This macro will generate a function with the following signature:
// pub fn bytes_to_u32(bytes: &[u8]) -> Result<Vec<u32>, anyhow::Error>
bytes_to_type!;
License
This project is licensed under the MIT License.