pub fn truncate_ip_to_prefix(ip: IpAddr) -> Result<String, Error> {
    match ip {
        IpAddr::V4(ip) => ipnet::Ipv4Net::new(ip, 28)
            .map(|i| i.trunc().to_string())
            .map_err(Error::new),
        IpAddr::V6(ip) => ipnet::Ipv6Net::new(ip, 56)
            .map(|i| i.trunc().to_string())
            .map_err(Error::new),
    }
}
/// Parses an IP string input and truncates it a prefix mask.
///
/// Truncates an IP to a privacy safe prefix mask and returns the network as a
/// CIDR string, such as `167.98.105.176/28`.
///
/// For IPv4 addresses we truncate to a /28 prefix and for IPv6 addresses we
/// truncate to /56.
Parses an IP string input and truncates it a prefix mask.
Truncates an IP to a privacy safe prefix mask and returns the network as a
CIDR string, such as `167.98.105.176/28`.

For IPv4 addresses we truncate to a /28 prefix and for IPv6 addresses we
truncate to /56.
Parses an IP string input and truncates it a prefix mask . Truncates an IP to a privacy safe prefix mask and returns the network as a CIDR string such as ` 167 . 98 . 105 . 176 / 28 ` . For IPv4 addresses we truncate to a / 28 prefix and for IPv6 addresses we truncate to / 56 .
pub fn truncate_ip_to_prefix(ip: IpAddr) -> Result<String, Error> {
    match ip {
        IpAddr::V4(ip) => ipnet::Ipv4Net::new(ip, 28)
            .map(|i| i.trunc().to_string())
            .map_err(Error::new),
        IpAddr::V6(ip) => ipnet::Ipv6Net::new(ip, 56)
            .map(|i| i.trunc().to_string())
            .map_err(Error::new),
    }
}
pub fn truncate_ip_to_prefix ( ip : IpAddr ) -> Result < String , Error > { match ip { IpAddr :: V4 ( ip ) => ipnet :: Ipv4Net :: new ( ip , 28 ) . map ( | i | i . trunc ( ) . to_string ( ) ) . map_err ( Error :: new ) , IpAddr :: V6 ( ip ) => ipnet :: Ipv6Net :: new ( ip , 56 ) . map ( | i | i . trunc ( ) . to_string ( ) ) . map_err ( Error :: new ) , } }
Parses an IP string input and truncates it a prefix mask.
Parses an IP string input and truncates it a prefix mask .
ip
IpAddr