mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
[GH-ISSUE #1865] "into_<fields>" methods #798
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#798
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @mattfbacon on GitHub (Dec 21, 2022).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/1865
Consider this struct: https://docs.rs/trust-dns-proto/0.22.0/trust_dns_proto/rr/rdata/mx/struct.MX.html
It has an owned Name field, but there is no way to get that out of it; you can only get &Name.
For efficiency purposes, I would like to be able to do
into_exchangeto get Name from MX.This applies in general to all similar data types.
@djc commented on GitHub (Dec 22, 2022):
Do you actually have a benchmark where this matters?
In general, pull requests for stuff like this are welcome! For this particular type, I wonder if we should just make the fields public instead...
@mattfbacon commented on GitHub (Dec 22, 2022):
I agree that making the fields public would be the best option if possible. I thought they were private for backwards-compatibility or something.
I don't think it makes a huge performance difference. It's just annoying to have to Clone when I would be able to take out the field.
@bluejekyll commented on GitHub (Dec 22, 2022):
Generally, I like keeping internal fields private, like you said @mattfbacon, for backward compatibility concerns. That being said, the RecordData types probably won't change, so maybe it's not a concern there?
@mattfbacon commented on GitHub (Dec 22, 2022):
OK if making the fields public is acceptable then I will make a PR doing that soon.
@djc commented on GitHub (Dec 27, 2022):
Yeah, for
RecordDatafields I think making the fields public is probably reasonable.@mattfbacon commented on GitHub (Dec 30, 2022):
Were these structs generated automatically somehow?
@djc commented on GitHub (Dec 30, 2022):
Nope!