/// Construct a Handshake from a slice of bytes
Construct a Handshake from a slice of bytes
Construct a Handshake from a slice of bytes
pub fn from_bytes(bytes: &[u8]) -> Result<SessionHandshake, ()> {
        if bytes.len() != SESSION_HANDSHAKE_LENGTH {
            return Err(());
        }
        let mut id: [u8; SESSION_ID_LENGTH] = [0u8; SESSION_ID_LENGTH];
        id.copy_from_slice(&bytes[..SESSION_ID_LENGTH]);
        Ok(SessionHandshake { id })
    }
pub fn from_bytes ( bytes : & [ u8 ] ) -> Result < SessionHandshake , ( ) > { if bytes . len ( ) != SESSION_HANDSHAKE_LENGTH { return Err ( ( ) ) ; } let mut id : [ u8 ; SESSION_ID_LENGTH ] = [ 0u8 ; SESSION_ID_LENGTH ] ; id . copy_from_slice ( & bytes [ .. SESSION_ID_LENGTH ] ) ; Ok ( SessionHandshake { id } ) }
Construct a Handshake from a slice of bytes
Construct a Handshake from a slice of bytes
bytes
&[u8]