mirror of
https://github.com/threefoldtech/mycelium.git
synced 2026-06-04 06:41:31 +00:00
Add network method to Subnet
Signed-off-by: Lee Smet <lee.smet@hotmail.com>
This commit is contained in:
+6
-1
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user