Crate lazy_bytes_cast [−] [src]
This crate provides simple methods to cast from and into byte arrays.
Note
The crates will not take care of byte order for you. Cuz lazy.
Usage example
extern crate lazy_bytes_cast; use lazy_bytes_cast::{ ToBytesCast, FromBytesCastLazy }; fn main() { let int_to: u32 = u32::max_value(); println!("result={:?}", int_to.to_bytes()); let bytes: [u8; 4] = [255, 255, 255, 255]; let result: u32 = bytes.cast_to(); println!("result={}", result); }
Traits
FromBytesCast |
Provides casting from bytes slice. |
FromBytesCastLazy |
Provides casting from fixed size arrays to integers |
ToBytesCast |
Trait to provide |
Functions
bytes_cast |
Converts slice of bytes to an integer. |
bytes_cast_lazy |
Unsafe version of |
to_bytes |
Converts data to a byte array. |