~jpastuszek/asn-db

97f9d7d93bd4cd12777f948c7fb232c3d28eda6e — Jakub Pastuszek 9 months ago ef5b534
making Ord/Eq impls in line and only based on base ip
1 files changed, 8 insertions(+), 2 deletions(-)

M src/lib.rs
M src/lib.rs => src/lib.rs +8 -2
@@ 62,7 62,7 @@ const DATABASE_DATA_TAG: &[u8; 4] = b"ASDB";
const DATABASE_DATA_VERSION: &[u8; 4] = b"bin1";

/// Autonomous System number record.
#[derive(Serialize, Deserialize, Debug, Clone, Eq, Ord)]
#[derive(Serialize, Deserialize, Debug, Clone, Eq)]
pub struct Record {
    /// Network base IP address (host byte order).
    pub ip: u32,


@@ 78,7 78,13 @@ pub struct Record {

impl PartialEq for Record {
    fn eq(&self, other: &Record) -> bool {
        self.ip == other.ip && self.prefix_len == other.prefix_len
        self.ip == other.ip
    }
}

impl Ord for Record {
    fn cmp(&self, other: &Record) -> Ordering {
        self.ip.cmp(&other.ip)
    }
}