Add network method to Subnet

Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
Lee Smet
2023-09-19 10:25:01 +02:00
parent d9f1ae306d
commit dd9ad18ec4
+6 -1
View File
@@ -61,10 +61,15 @@ impl Subnet {
self.inner.contains(&other.inner)
}
/// Cheks if this `Subnet` contains the provided [`IpAddr`].
/// Checks if this `Subnet` contains the provided [`IpAddr`].
pub fn contains_ip(&self, ip: IpAddr) -> bool {
self.inner.contains(&ip)
}
/// Returns the network part of the `Subnet`. All non prefix bits are set to 0.
pub fn network(&self) -> IpAddr {
self.inner.network()
}
}
impl fmt::Display for Subnet {