mirror of
https://github.com/achanda/ipnetwork.git
synced 2025-06-14 16:26:32 +00:00
Make IpNetwork::ip
const (#212)
This commit is contained in:

committed by
GitHub

parent
a21f5df04e
commit
5f929258ef
@ -140,7 +140,7 @@ impl Ipv4Network {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ip(self) -> Ipv4Addr {
|
||||
pub const fn ip(self) -> Ipv4Addr {
|
||||
self.addr
|
||||
}
|
||||
|
||||
|
@ -160,7 +160,7 @@ impl Ipv6Network {
|
||||
}
|
||||
}
|
||||
|
||||
pub fn ip(&self) -> Ipv6Addr {
|
||||
pub const fn ip(&self) -> Ipv6Addr {
|
||||
self.addr
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ impl IpNetwork {
|
||||
}
|
||||
|
||||
/// Returns the IP part of a given `IpNetwork`
|
||||
pub fn ip(&self) -> IpAddr {
|
||||
pub const fn ip(&self) -> IpAddr {
|
||||
match *self {
|
||||
IpNetwork::V4(ref a) => IpAddr::V4(a.ip()),
|
||||
IpNetwork::V6(ref a) => IpAddr::V6(a.ip()),
|
||||
|
Reference in New Issue
Block a user