/// Deserialize a value from a slice of bytes.
/// This function will panic if the slice is not long enough.
Deserialize a value from a slice of bytes.
This function will panic if the slice is not long enough.
Deserialize a value from a slice of bytes . This function will panic if the slice is not long enough .
pub fn deserialize<T>(src: &[u8]) -> &T {
    let len = src.len();
    let size = mem::size_of::<T>();
    assert!(len >= size, "src not big enough: the len is {} but the size of T is {}", len, size);
    unsafe { mem::transmute::<_, &T>(src.as_ptr()) }
}
pub fn deserialize < T > ( src : & [ u8 ] ) -> & T { let len = src . len ( ) ; let size = mem :: size_of :: < T > ( ) ; assert ! ( len size " " len size ) ; unsafe { mem :: transmute :: < _ , & T > ( src . as_ptr ( ) ) } }
Deserialize a value from a slice of bytes.
Deserialize a value from a slice of bytes .
src
&[u8]