diff --git a/src/ipv4.rs b/src/ipv4.rs index 9b0395a..a944598 100644 --- a/src/ipv4.rs +++ b/src/ipv4.rs @@ -35,7 +35,7 @@ impl Ipv4Network { /// Constructs a new `Ipv4Network` from any `Ipv4Addr` and a prefix denoting the network size. /// /// If the prefix is larger than 32 this will return an `IpNetworkError::InvalidPrefix`. - pub fn new(addr: Ipv4Addr, prefix: u8) -> Result { + pub const fn new(addr: Ipv4Addr, prefix: u8) -> Result { if prefix > IPV4_BITS { Err(IpNetworkError::InvalidPrefix) } else { diff --git a/src/ipv6.rs b/src/ipv6.rs index 4013086..558bc6e 100644 --- a/src/ipv6.rs +++ b/src/ipv6.rs @@ -36,7 +36,7 @@ impl Ipv6Network { /// Constructs a new `Ipv6Network` from any `Ipv6Addr` and a prefix denoting the network size. /// /// If the prefix is larger than 128 this will return an `IpNetworkError::InvalidPrefix`. - pub fn new(addr: Ipv6Addr, prefix: u8) -> Result { + pub const fn new(addr: Ipv6Addr, prefix: u8) -> Result { if prefix > IPV6_BITS { Err(IpNetworkError::InvalidPrefix) } else {