pub fn parse_macaddr(input: &[u8]) -> Result<MacAddr, NlError> {
    if input.len() == 6 {
        let array: [u8; 6] = input
            .try_into()
            .expect("Slice with incorrect number of bytes");
        Ok(array.into())
    } else if input.len() == 8 {
        let array: [u8; 8] = input
            .try_into()
            .expect("Slice with incorrect number of bytes");
        Ok(array.into())
    } else {
        Err(NlError::Msg(format!(
            "Encountered a {}-byte MAC address",
            input.len()
        )))
    }
}
/// Parse a vec of bytes as a mac address
Parse a vec of bytes as a mac address
Parse a vec of bytes as a mac address
pub fn parse_macaddr(input: &[u8]) -> Result<MacAddr, NlError> {
    if input.len() == 6 {
        let array: [u8; 6] = input
            .try_into()
            .expect("Slice with incorrect number of bytes");
        Ok(array.into())
    } else if input.len() == 8 {
        let array: [u8; 8] = input
            .try_into()
            .expect("Slice with incorrect number of bytes");
        Ok(array.into())
    } else {
        Err(NlError::Msg(format!(
            "Encountered a {}-byte MAC address",
            input.len()
        )))
    }
}
pub fn parse_macaddr ( input : & [ u8 ] ) -> Result < MacAddr , NlError > { if input . len ( ) == 6 { let array : [ u8 ; 6 ] = input . try_into ( ) . expect ( " " ) ; Ok ( array . into ( ) ) } else if input . len ( ) == 8 { let array : [ u8 ; 8 ] = input . try_into ( ) . expect ( " " ) ; Ok ( array . into ( ) ) } else { Err ( NlError :: Msg ( format ! ( " " input len ( ) ) ) ) } }
Parse a vec of bytes as a mac address
Parse a vec of bytes as a mac address
input
&[u8]
input
&[u8]