keepsimple1 / mdns-sd

Rust library for mDNS based Service Discovery
Apache License 2.0
104 stars 39 forks source link

feat: extract match addr to type as a function #205

Closed CosminPerRam closed 7 months ago

CosminPerRam commented 7 months ago

I have seen the repeated usage of

match address {
    IpAddr::V4(_) => TYPE_A,
    IpAddr::V6(_) => TYPE_AAAA,
}

in multiple places, although this is a very simple operation, it could be extracted into a function (which is what this PR does). I'm not really sure if the function name ip_address_to_type and its location are appropriate.