mirror of
https://github.com/achanda/ipnetwork.git
synced 2025-06-15 16:43:00 +00:00
Make IpNetwork::is_ipv4
and IpNetwork::is_ipv6
const (#213)
This commit is contained in:

committed by
GitHub

parent
5f929258ef
commit
aa65f088b1
@ -245,7 +245,7 @@ impl IpNetwork {
|
|||||||
/// assert_eq!(v4.is_ipv4(), true);
|
/// assert_eq!(v4.is_ipv4(), true);
|
||||||
/// assert_eq!(v4.is_ipv6(), false);
|
/// assert_eq!(v4.is_ipv6(), false);
|
||||||
///```
|
///```
|
||||||
pub fn is_ipv4(&self) -> bool {
|
pub const fn is_ipv4(&self) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
IpNetwork::V4(_) => true,
|
IpNetwork::V4(_) => true,
|
||||||
IpNetwork::V6(_) => false,
|
IpNetwork::V6(_) => false,
|
||||||
@ -264,7 +264,7 @@ impl IpNetwork {
|
|||||||
/// assert_eq!(v6.is_ipv6(), true);
|
/// assert_eq!(v6.is_ipv6(), true);
|
||||||
/// assert_eq!(v6.is_ipv4(), false);
|
/// assert_eq!(v6.is_ipv4(), false);
|
||||||
///```
|
///```
|
||||||
pub fn is_ipv6(&self) -> bool {
|
pub const fn is_ipv6(&self) -> bool {
|
||||||
match *self {
|
match *self {
|
||||||
IpNetwork::V4(_) => false,
|
IpNetwork::V4(_) => false,
|
||||||
IpNetwork::V6(_) => true,
|
IpNetwork::V6(_) => true,
|
||||||
|
Reference in New Issue
Block a user