[PR #3134] [MERGED] Simplify and replace future combinators #3588

Closed
opened 2026-03-16 11:51:48 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/3134
Author: @divergentdave
Created: 7/18/2025
Status: Merged
Merged: 7/22/2025
Merged by: @divergentdave

Base: mainHead: david/replace-tryfuture-combinators


📝 Commits (10+)

  • a555106 Simplify future combinators in DnssecDnsHandle
  • dc63c41 Replace future combinators in tests
  • ba4bb7e Replace future combinators in stream constructors
  • 46e381e Remove extra box in DNS multiplexer
  • 937a83c Use BoxFuture type alias
  • a62d20a Remove use of TryFutureExt in doc test
  • e9c353c Remove unnecessary boxing
  • d2bc7f4 Replace uses of FutureExt::map with async blocks
  • 05f6cf7 Rewrite test helper as async function
  • 23e04ec Further simplify TcpStream::connect_with_future()

📊 Changes

27 files changed (+251 additions, -305 deletions)

View changed files

📝 crates/proto/src/dnssec/dnssec_dns_handle/mod.rs (+10 -7)
📝 crates/proto/src/h2/h2_client_stream.rs (+23 -32)
📝 crates/proto/src/h3/h3_client_stream.rs (+6 -6)
📝 crates/proto/src/multicast/mdns_client_stream.rs (+11 -11)
📝 crates/proto/src/multicast/mdns_stream.rs (+36 -35)
📝 crates/proto/src/quic/quic_client_stream.rs (+6 -7)
📝 crates/proto/src/rustls/tls_client_stream.rs (+6 -16)
📝 crates/proto/src/rustls/tls_stream.rs (+8 -29)
📝 crates/proto/src/tcp/tcp_client_stream.rs (+2 -4)
📝 crates/proto/src/tcp/tcp_stream.rs (+13 -20)
📝 crates/proto/src/udp/udp_client_stream.rs (+1 -1)
📝 crates/proto/src/udp/udp_stream.rs (+12 -7)
📝 crates/proto/src/xfer/dns_exchange.rs (+8 -14)
📝 crates/proto/src/xfer/dns_multiplexer.rs (+11 -10)
📝 crates/proto/src/xfer/dns_response.rs (+4 -8)
📝 crates/recursor/src/recursor_pool.rs (+5 -5)
📝 crates/resolver/src/caching_client.rs (+3 -4)
📝 crates/resolver/src/lib.rs (+4 -6)
📝 crates/resolver/src/lookup_ip.rs (+5 -2)
📝 crates/resolver/src/name_server/name_server_pool.rs (+3 -3)

...and 7 more files

📄 Description

This replaces all TryFutureExt::map_ok() and TryFutureExt::map_err() uses with async-await and regular control flow, or a FutureExt::map() call in one case where we need an Unpin future for select_ok(). Some FutureExt::map() uses are replaced with straight-line async code as well. All Box<dyn Future + Unpin> types were replaced with Pin<Box<dyn Future>>, because we may as well leverage the box allocation itself to satisfy pinning requirements. This also removes some unnecessary FutureExt::boxed() calls where they aren't needed (including some cases that nested two boxes). I rewrote all pinned boxed future types with the futures_util::futures::BoxFuture type alias.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hickory-dns/hickory-dns/pull/3134 **Author:** [@divergentdave](https://github.com/divergentdave) **Created:** 7/18/2025 **Status:** ✅ Merged **Merged:** 7/22/2025 **Merged by:** [@divergentdave](https://github.com/divergentdave) **Base:** `main` ← **Head:** `david/replace-tryfuture-combinators` --- ### 📝 Commits (10+) - [`a555106`](https://github.com/hickory-dns/hickory-dns/commit/a55510610af7784d03824245c340eade5f0e184f) Simplify future combinators in DnssecDnsHandle - [`dc63c41`](https://github.com/hickory-dns/hickory-dns/commit/dc63c4184cc6417a7b8fd3d02dbb537de754280c) Replace future combinators in tests - [`ba4bb7e`](https://github.com/hickory-dns/hickory-dns/commit/ba4bb7e2ea2c17ced517c8872562721ee52665cb) Replace future combinators in stream constructors - [`46e381e`](https://github.com/hickory-dns/hickory-dns/commit/46e381ef81a2615c865bfed407050380849e3d3f) Remove extra box in DNS multiplexer - [`937a83c`](https://github.com/hickory-dns/hickory-dns/commit/937a83c1de59daa5e7d11c48ec9a2ddefcdebdf4) Use BoxFuture type alias - [`a62d20a`](https://github.com/hickory-dns/hickory-dns/commit/a62d20a6ac3a96bd93a74f97e639ba6ff96957e4) Remove use of TryFutureExt in doc test - [`e9c353c`](https://github.com/hickory-dns/hickory-dns/commit/e9c353c2ff63bb074569eb58c3f9d122e28e0369) Remove unnecessary boxing - [`d2bc7f4`](https://github.com/hickory-dns/hickory-dns/commit/d2bc7f4afe49cee899fe9739ec4095dcff6214f3) Replace uses of FutureExt::map with async blocks - [`05f6cf7`](https://github.com/hickory-dns/hickory-dns/commit/05f6cf7845ba7a3f2a2b3d12b6abbbb6612de433) Rewrite test helper as async function - [`23e04ec`](https://github.com/hickory-dns/hickory-dns/commit/23e04ec42b18814bcba2eb1a2d4387d3001c51c1) Further simplify TcpStream::connect_with_future() ### 📊 Changes **27 files changed** (+251 additions, -305 deletions) <details> <summary>View changed files</summary> 📝 `crates/proto/src/dnssec/dnssec_dns_handle/mod.rs` (+10 -7) 📝 `crates/proto/src/h2/h2_client_stream.rs` (+23 -32) 📝 `crates/proto/src/h3/h3_client_stream.rs` (+6 -6) 📝 `crates/proto/src/multicast/mdns_client_stream.rs` (+11 -11) 📝 `crates/proto/src/multicast/mdns_stream.rs` (+36 -35) 📝 `crates/proto/src/quic/quic_client_stream.rs` (+6 -7) 📝 `crates/proto/src/rustls/tls_client_stream.rs` (+6 -16) 📝 `crates/proto/src/rustls/tls_stream.rs` (+8 -29) 📝 `crates/proto/src/tcp/tcp_client_stream.rs` (+2 -4) 📝 `crates/proto/src/tcp/tcp_stream.rs` (+13 -20) 📝 `crates/proto/src/udp/udp_client_stream.rs` (+1 -1) 📝 `crates/proto/src/udp/udp_stream.rs` (+12 -7) 📝 `crates/proto/src/xfer/dns_exchange.rs` (+8 -14) 📝 `crates/proto/src/xfer/dns_multiplexer.rs` (+11 -10) 📝 `crates/proto/src/xfer/dns_response.rs` (+4 -8) 📝 `crates/recursor/src/recursor_pool.rs` (+5 -5) 📝 `crates/resolver/src/caching_client.rs` (+3 -4) 📝 `crates/resolver/src/lib.rs` (+4 -6) 📝 `crates/resolver/src/lookup_ip.rs` (+5 -2) 📝 `crates/resolver/src/name_server/name_server_pool.rs` (+3 -3) _...and 7 more files_ </details> ### 📄 Description This replaces all `TryFutureExt::map_ok()` and `TryFutureExt::map_err()` uses with async-await and regular control flow, or a `FutureExt::map()` call in one case where we need an `Unpin` future for `select_ok()`. Some `FutureExt::map()` uses are replaced with straight-line async code as well. All `Box<dyn Future + Unpin>` types were replaced with `Pin<Box<dyn Future>>`, because we may as well leverage the box allocation itself to satisfy pinning requirements. This also removes some unnecessary `FutureExt::boxed()` calls where they aren't needed (including some cases that nested two boxes). I rewrote all pinned boxed future types with the `futures_util::futures::BoxFuture` type alias. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 11:51:48 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#3588
No description provided.