/// Decodes uuid from an unknown source
Decodes uuid from an unknown source
Decodes uuid from an unknown source
pub(crate) fn decode_uuid(bytes: &mut impl Iterator<Item = u8>) -> Result<Uuid> {
    const UUID_LEN: usize = 16;
    let bytes: Vec<u8> = bytes.take(UUID_LEN).collect();
    if bytes.len() != UUID_LEN {
        Err(Error::MessageEnded)
    } else {
        Ok(Uuid::from_bytes(bytes.try_into().unwrap()))
    }
}
pub ( crate ) fn decode_uuid ( bytes : & mut impl Iterator < Item = u8 > ) -> Result < Uuid > { const UUID_LEN : usize = 16 ; let bytes : Vec < u8 > = bytes . take ( UUID_LEN ) . collect ( ) ; if bytes . len ( ) != UUID_LEN { Err ( Error :: MessageEnded ) } else { Ok ( Uuid :: from_bytes ( bytes . try_into ( ) . unwrap ( ) ) ) } }
Decodes uuid from an unknown source
Decodes uuid from an unknown source
bytes
&mut impl Iterator<Item = u8>