Skip to main content

as_u8_slice

Function as_u8_slice 

Source
pub unsafe fn as_u8_slice<T: Sized, const N: usize>(p: T) -> [u8; N]
Expand description

this transforms any generic struct type variable into raw data

struct MyStruct { a: int, b: bool }

let var = MyStruct { a: 2, b: false };
let raw = dirty::as_u8_slice<MyStruct>(var);