Skip to content

Derive Eq for DnsContent #226

@ferrohd

Description

@ferrohd

Currently, comparisons between DnsContent instances require explicit matching of the enum variants.

let dns1: DnsContent = ...;
let dns2: DnsContent = ...;

let is_same_record: bool = match (dns1, dns2) {
    (DnsContent::A { content: ip1 }, DnsContent::A { content: ip2 }) => ip1 == ip2,
    // ...
    _ => false
};

Deriving Eq (and therefore PartialEq), DnsContent instances can be compared using the == operator, providing a more ergonomic API to interact with DNS records.

let dns1: DnsContent = ...;
let dns2: DnsContent = ...;

let same_record: bool = dns1 == dns2;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions