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
ByteIndex |
Provides indexing over integer bytes |
ByteSlice |
Returns slice of bytes from integer |
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 |
copy_to_bytes |
Converts data to a byte array by writing it into mutable slice |
to_bytes |
Converts data to a byte array. |