diff --git a/src/ipv4.rs b/src/ipv4.rs index 3f31991..32cfd66 100644 --- a/src/ipv4.rs +++ b/src/ipv4.rs @@ -7,7 +7,7 @@ use common::{IpNetworkError, cidr_parts, parse_prefix, parse_addr}; const IPV4_BITS: u8 = 32; /// Represents a network range where the IP addresses are of v4 -#[derive(Debug,Clone,Copy,Hash,PartialEq,Eq)] +#[derive(Debug,Clone,Copy,Hash,PartialEq,Eq,PartialOrd,Ord)] pub struct Ipv4Network { addr: Ipv4Addr, prefix: u8, diff --git a/src/ipv6.rs b/src/ipv6.rs index bdb0247..f46f84d 100644 --- a/src/ipv6.rs +++ b/src/ipv6.rs @@ -9,7 +9,7 @@ const IPV6_BITS: u8 = 128; const IPV6_SEGMENT_BITS: u8 = 16; /// Represents a network range where the IP addresses are of v6 -#[derive(Debug,Clone,Copy,Hash,PartialEq,Eq)] +#[derive(Debug,Clone,Copy,Hash,PartialEq,Eq,PartialOrd,Ord)] pub struct Ipv6Network { addr: Ipv6Addr, prefix: u8, diff --git a/src/lib.rs b/src/lib.rs index c063e19..d5c8190 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -20,7 +20,7 @@ pub use common::IpNetworkError; /// Represents a generic network range. This type can have two variants: /// the v4 and the v6 case. -#[derive(Debug,Clone,Copy,Hash,PartialEq,Eq)] +#[derive(Debug,Clone,Copy,Hash,PartialEq,Eq,PartialOrd,Ord)] pub enum IpNetwork { V4(Ipv4Network), V6(Ipv6Network),