/// Read header bytes received in payload.
Read header bytes received in payload.
Read header bytes received in payload .
fn unpack_header(data: Vec<u8>) -> TransportHeader {
        let mut header = TransportHeader {
            version: 0,
            flags: 0,
            reserved: 0,
            payload_length: 0,
        };
        let (version_byte, rest) = data.split_at(std::mem::size_of::<u8>());
        header.version = u8::from_le_bytes(version_byte.try_into().unwrap());
        let (flags_byte, rest) = rest.split_at(std::mem::size_of::<u8>());
        header.flags = u8::from_le_bytes(flags_byte.try_into().unwrap());
        let (reserved_bytes, rest) = rest.split_at(std::mem::size_of::<u16>());
        header.reserved = u16::from_le_bytes(reserved_bytes.try_into().unwrap());
        let (payload_length_bytes, _rest) = rest.split_at(std::mem::size_of::<u32>());
        header.payload_length = u32::from_le_bytes(payload_length_bytes.try_into().unwrap());
        header
    }
fn unpack_header ( data : Vec < u8 > ) -> TransportHeader { let mut header = TransportHeader { version : 0 , flags : 0 , reserved : 0 , payload_length : 0 , } ; let ( version_byte , rest ) = data . split_at ( std :: mem :: size_of :: < u8 > ( ) ) ; header . version = u8 :: from_le_bytes ( version_byte . try_into ( ) . unwrap ( ) ) ; let ( flags_byte , rest ) = rest . split_at ( std :: mem :: size_of :: < u8 > ( ) ) ; header . flags = u8 :: from_le_bytes ( flags_byte . try_into ( ) . unwrap ( ) ) ; let ( reserved_bytes , rest ) = rest . split_at ( std :: mem :: size_of :: < u16 > ( ) ) ; header . reserved = u16 :: from_le_bytes ( reserved_bytes . try_into ( ) . unwrap ( ) ) ; let ( payload_length_bytes , _rest ) = rest . split_at ( std :: mem :: size_of :: < u32 > ( ) ) ; header . payload_length = u32 :: from_le_bytes ( payload_length_bytes . try_into ( ) . unwrap ( ) ) ; header }
Read header bytes received in payload.
Read header bytes received in payload .
data
Vec<u8>