[PR #1541] [MERGED] Remove AsyncClientConnect and AsyncSecureClientConnect in favor of async constructors #2404

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

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/1541
Author: @ErwanDL
Created: 8/20/2021
Status: Merged
Merged: 8/23/2021
Merged by: @bluejekyll

Base: mainHead: remove-asyncclientconnect


📝 Commits (3)

  • 002fd36 remove AsyncClientConnect and AsyncSecureClientConnect in favor of async constructors
  • fdfbfc8 Merge branch 'main' into remove-asyncclientconnect
  • a953a52 Merge branch 'main' into remove-asyncclientconnect

📊 Changes

3 files changed (+56 additions, -104 deletions)

View changed files

📝 crates/client/src/client/async_client.rs (+40 -51)
📝 crates/client/src/client/async_secure_client.rs (+14 -47)
📝 crates/client/src/client/mod.rs (+2 -6)

📄 Description

This is the second PR associated with #1532, removing the intermediate AsyncClientConnect object in favor of async functions to construct the AsyncClient, as discussed on the issue.

On another note, I am quite confused by the AsyncClient vs AsyncClientConnect distinction. Are there reasons not to define AsyncClient::new and AsyncClient::connect as async fn that return an AsyncClient once they have been awaited ? This could remove the need for this intermediary AsyncConnect object.

I think those functions can be simplified. The only reason I can think that didn't happen is because AsyncClient is older than async/await in Rust. Most likely it can be simplified to be async fn instead of Future implementations. If that's something you'd be interested in working on, it would be appreciated...

I also removed AsyncSecureClientConnect and make similar changes to AsyncDnssecClient as they were also based on AsyncClientConnect/AsyncClient.

There should be very little to no changes in usage for users, and the tests still all pass on my machine without having had to make any change to them.


🔄 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/1541 **Author:** [@ErwanDL](https://github.com/ErwanDL) **Created:** 8/20/2021 **Status:** ✅ Merged **Merged:** 8/23/2021 **Merged by:** [@bluejekyll](https://github.com/bluejekyll) **Base:** `main` ← **Head:** `remove-asyncclientconnect` --- ### 📝 Commits (3) - [`002fd36`](https://github.com/hickory-dns/hickory-dns/commit/002fd36070ceda48662b5d452c41066ec3290542) remove AsyncClientConnect and AsyncSecureClientConnect in favor of async constructors - [`fdfbfc8`](https://github.com/hickory-dns/hickory-dns/commit/fdfbfc8c5178e4efffe930f7bb3f4c02fa32a389) Merge branch 'main' into remove-asyncclientconnect - [`a953a52`](https://github.com/hickory-dns/hickory-dns/commit/a953a52f99c810d91b238827b57fb26d387f118a) Merge branch 'main' into remove-asyncclientconnect ### 📊 Changes **3 files changed** (+56 additions, -104 deletions) <details> <summary>View changed files</summary> 📝 `crates/client/src/client/async_client.rs` (+40 -51) 📝 `crates/client/src/client/async_secure_client.rs` (+14 -47) 📝 `crates/client/src/client/mod.rs` (+2 -6) </details> ### 📄 Description This is the second PR associated with #1532, removing the intermediate `AsyncClientConnect` object in favor of `async` functions to construct the `AsyncClient`, as discussed on the issue. > > On another note, I am quite confused by the AsyncClient vs AsyncClientConnect distinction. Are there reasons not to define AsyncClient::new and AsyncClient::connect as async fn that return an AsyncClient once they have been awaited ? This could remove the need for this intermediary AsyncConnect object. > > I think those functions can be simplified. The only reason I can think that didn't happen is because AsyncClient is older than async/await in Rust. Most likely it can be simplified to be `async fn` instead of Future implementations. If that's something you'd be interested in working on, it would be appreciated... I also removed `AsyncSecureClientConnect` and make similar changes to `AsyncDnssecClient` as they were also based on `AsyncClientConnect`/`AsyncClient`. There should be very little to no changes in usage for users, and the tests still all pass on my machine without having had to make any change to them. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 08:51:56 +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#2404
No description provided.