lazy-bytes-cast 5.0.1

Lazy casts from & to byte arrays
Documentation

lazy-bytes-cast

Build Crates.io Docs.rs

This crate provides simple methods to cast from and into byte arrays.

Example

use lazy_bytes_cast::{FromByteArray, IntoByteArray, AsByteSlice, FromByteSlice};

let val = 9999999u32;
let bytes = [127u8, 150, 152, 0];
assert_eq!(val.as_slice(), bytes);
assert_eq!(val.into_byte_array(), bytes);

assert_eq!(u32::from_slice(&bytes).unwrap(), val);
assert_eq!(u32::from_byte_array(bytes), val);