mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
[GH-ISSUE #730] Lookup results should implement IntoIterator #283
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#283
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 @olivia-fl on GitHub (Apr 5, 2019).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/730
I'm trying to return a mapped iterator over
LookupIpfrom a function. This doesn't work right now without first collecting theLookupIpIterinto a container, and then callinginto_iter. This is becauseLookupIpIterborrowsLookupIp, so you can't return it from a function since it borrows a local variable.Ideally, all of the
*Lookup*structs that have anitermethod should also implementIntoIteratorso that you can do this type of thing. It would behave identically to the current iterators, except that it would own the lookup struct rather than borrowing it.Obviously, the
.collect::<Vec<_>>().into_iter()approach does work, but it's both extra boilerplate and less efficient.@bluejekyll commented on GitHub (Apr 6, 2019):
This is a good suggestion. I’m happy to take pull requests. Otherwise I’ll play around with this when I have some time.
@bluejekyll commented on GitHub (Apr 7, 2019):
So looking at this, there's a bit of a complication, which is that ideally the interface would look like this:
The issue is that the Lookup types wrap an
Arcof theVecof the returned records. This is because the records are cached and returned from the cache. What we can do isArc::try_unwrap, but this will generally fail, and we'll end up cloning the internalVec, thus being a costly conversion. As an ease of use thing, this is fine, but it's too bad that it will incur this cost.@bluejekyll commented on GitHub (Apr 7, 2019):
Ok, @Benjamin-L, see #734 for my suggested implementation. Let me know if you had something else in mind.