/// Convert a given slice of Sized type instances to a slice of bytes.
Convert a given slice of Sized type instances to a slice of bytes.
Convert a given slice of Sized type instances to a slice of bytes .
pub fn slice_as_bytes<'a, T: Sized>(data: &'a [T]) -> &'a [u8] {
    let ptr  = data.as_ptr();
    let size = mem::size_of::<T>();
    unsafe {
        slice::from_raw_parts(ptr as *const u8, size * data.len())
    }
}
pub fn slice_as_bytes < ' a , T : Sized > ( data : & ' a [ T ] ) -> & ' a [ u8 ] { let ptr = data . as_ptr ( ) ; let size = mem :: size_of :: < T > ( ) ; unsafe { slice :: from_raw_parts ( ptr as * const u8 , size * data . len ( ) ) } }
Convert a given slice of Sized type instances to a slice of bytes.
Convert a given slice of Sized type instances to a slice of bytes .
data
&'a [T]