Closed
Description
This is the tracking issue for IP address prefixes such as 192.0.2.0/24
.
The feature gate for the issue is #![feature(ip_prefix)]
.
Overview
Ipv4AddrPrefix
#[derive(Copy, PartialEq, Eq, Clone, Hash)]
pub struct Ipv4AddrPrefix {
address: Ipv4Addr,
len: u8,
}
impl Ipv4AddrPrefix {
pub const fn new(address: Ipv4AddrPrefix, len: u32) -> Result<Ipv4AddrPrefix, InvalidPrefixError>;
pub const fn address(&self) -> Ipv4Addr;
pub const fn len(&self) -> u32;
pub const fn contains(&self, address: &Ipv4Addr) -> bool;
}
impl Debug for Ipv4AddrPrefix {}
impl Display for Ipv4AddrPrefix {}
impl From<Ipv4Addr> for Ipv4AddrPrefix {}
impl FromStr for Ipv4AddrPrefix {}
Ipv6AddrPrefix
#[derive(Copy, PartialEq, Eq, Clone, Hash)]
pub struct Ipv6AddrPrefix {
address: Ipv6Addr,
len: u8,
}
impl Ipv6AddrPrefix {
pub const fn new(address: Ipv6AddrPrefix, len: u32) -> Result<Ipv6AddrPrefix, InvalidPrefixError>;
pub const fn address(&self) -> Ipv6Addr;
pub const fn len(&self) -> u32;
pub const fn contains(&self, address: &Ipv6Addr) -> bool;
}
impl Debug for Ipv6AddrPrefix {}
impl Display for Ipv6AddrPrefix {}
impl From<Ipv6Addr> for Ipv6AddrPrefix {}
impl FromStr for Ipv6AddrPrefix {}
Unresolved Questions
Implementation history
- Implementation PR: Introduce unstable
Ipv{4,6}AddrPrefix
#86992