fn parse_addr(val: &str) -> Option<SocketAddrV4> {
    if val.len() != 13 {
        return None;
    }
    let port = match u16::from_str_radix(&val[9..13], 16) {
        Ok(x) => x,
        Err(..) => return None,
    };
    let ip = match u32::from_str_radix(&val[..8], 16) {
        Ok(x) => u32::from_be(x),
        Err(..) => return None,
    };
    Some(SocketAddrV4::new(Ipv4Addr::from(ip), port))
}
/// Parses socket addr defined in /proc/net/tcp
/// It hexadecimal ip:port so it's fixed size
Parses socket addr defined in /proc/net/tcp
It hexadecimal ip:port so it's fixed size
Parses socket addr defined in / proc / net / tcp It hexadecimal ip : port so it ' s fixed size
fn parse_addr(val: &str) -> Option<SocketAddrV4> {
    if val.len() != 13 {
        return None;
    }
    let port = match u16::from_str_radix(&val[9..13], 16) {
        Ok(x) => x,
        Err(..) => return None,
    };
    let ip = match u32::from_str_radix(&val[..8], 16) {
        Ok(x) => u32::from_be(x),
        Err(..) => return None,
    };
    Some(SocketAddrV4::new(Ipv4Addr::from(ip), port))
}
fn parse_addr ( val : & str ) -> Option < SocketAddrV4 > { if val . len ( ) != 13 { return None ; } let port = match u16 :: from_str_radix ( & val [ 9 .. 13 ] , 16 ) { Ok ( x ) => x , Err ( .. ) => return None , } ; let ip = match u32 :: from_str_radix ( & val [ .. 8 ] , 16 ) { Ok ( x ) => u32 :: from_be ( x ) , Err ( .. ) => return None , } ; Some ( SocketAddrV4 :: new ( Ipv4Addr :: from ( ip ) , port ) ) }
Parses socket addr defined in /proc/net/tcp
It hexadecimal ip:port so it's fixed size
Parses socket addr defined in / proc / net / tcp It hexadecimal ip : port so it ' s fixed size
val
&str
val
&str