pub fn slice_to_ipv4addr(slice: &[u8]) -> Ipv4Addr {
    if slice.len() < 4 {
        panic!("slice is too short");
    } else {
        let ptr  = slice.as_ptr() as *const u32;
        let addr = unsafe { u32::from_be(*ptr) };
        Ipv4Addr::from(addr)
    }
}
/// Convert a given slice of bytes into IPv4 address.
Convert a given slice of bytes into IPv4 address.
Convert a given slice of bytes into IPv4 address .
pub fn slice_to_ipv4addr(slice: &[u8]) -> Ipv4Addr {
    if slice.len() < 4 {
        panic!("slice is too short");
    } else {
        let ptr  = slice.as_ptr() as *const u32;
        let addr = unsafe { u32::from_be(*ptr) };
        Ipv4Addr::from(addr)
    }
}
pub fn slice_to_ipv4addr ( slice : & [ u8 ] ) -> Ipv4Addr { if slice . len ( ) < 4 { panic ! ( " " ) ; } else { let ptr = slice . as_ptr ( ) as * const u32 ; let addr = unsafe { u32 :: from_be ( * ptr ) } ; Ipv4Addr :: from ( addr ) } }
Convert a given slice of bytes into IPv4 address.
Convert a given slice of bytes into IPv4 address .
slice
&[u8]
slice
&[u8]