Skip to main content

parse_ip_net

Function parse_ip_net 

pub fn parse_ip_net(value: &str) -> Result<IpNet, AddrParseError>
Available on crate feature net only.
Expand description

Parse an IP network from canonical CIDR syntax or abbreviated IPv4 CIDR syntax commonly emitted by operating-system network configuration APIs.

Canonical IPv4 and IPv6 networks retain ipnet::IpNet’s normal parsing behavior. An abbreviated IPv4 address containing one to three octets is completed with zero-valued trailing octets, so 10/8, 172.16/12, and 192.168.1/24 parse like 10.0.0.0/8, 172.16.0.0/12, and 192.168.1.0/24 respectively.

This parser does not accept abbreviated IPv4 addresses without a prefix.