pub fn increment_ip(ip: IpAddr) -> Option<IpAddr> {
    match ip {
        IpAddr::V4(ip) => {
            let mut bytes: [u8; 4] = ip.octets();
            increment_ip_bytes(&mut bytes);
            if bytes.iter().fold(true, |acc, byte| acc && *byte == 0) {
                return None;
            }
            Some(Ipv4Addr::from(bytes).into())
        }
        IpAddr::V6(ip) => {
            let mut bytes: [u8; 16] = ip.octets();
            increment_ip_bytes(&mut bytes);
            if bytes.iter().fold(true, |acc, byte| acc && *byte == 0) {
                return None;
            }
            Some(Ipv6Addr::from(bytes).into())
        }
    }
}
/// Returns the IP address which immediately follows the given IP address. If
/// the increment overflowed (i.e., the given input IP was already the largest
/// possible IP address), None is returned instead.
Returns the IP address which immediately follows the given IP address. If
the increment overflowed , None is returned instead.
Returns the IP address which immediately follows the given IP address . If the increment overflowed None is returned instead .
pub fn increment_ip(ip: IpAddr) -> Option<IpAddr> {
    match ip {
        IpAddr::V4(ip) => {
            let mut bytes: [u8; 4] = ip.octets();
            increment_ip_bytes(&mut bytes);
            if bytes.iter().fold(true, |acc, byte| acc && *byte == 0) {
                return None;
            }
            Some(Ipv4Addr::from(bytes).into())
        }
        IpAddr::V6(ip) => {
            let mut bytes: [u8; 16] = ip.octets();
            increment_ip_bytes(&mut bytes);
            if bytes.iter().fold(true, |acc, byte| acc && *byte == 0) {
                return None;
            }
            Some(Ipv6Addr::from(bytes).into())
        }
    }
}
pub fn increment_ip ( ip : IpAddr ) -> Option < IpAddr > { match ip { IpAddr :: V4 ( ip ) => { let mut bytes : [ u8 ; 4 ] = ip . octets ( ) ; increment_ip_bytes ( & mut bytes ) ; if bytes . iter ( ) . fold ( true , | acc , byte | acc && * byte == 0 ) { return None ; } Some ( Ipv4Addr :: from ( bytes ) . into ( ) ) } IpAddr :: V6 ( ip ) => { let mut bytes : [ u8 ; 16 ] = ip . octets ( ) ; increment_ip_bytes ( & mut bytes ) ; if bytes . iter ( ) . fold ( true , | acc , byte | acc && * byte == 0 ) { return None ; } Some ( Ipv6Addr :: from ( bytes ) . into ( ) ) } } }
Returns the IP address which immediately follows the given IP address.
Returns the IP address which immediately follows the given IP address .
ip
IpAddr
ip
IpAddr