[PR #124] [CLOSED] limit generic functions of Client to Sized types #1253

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

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/124
Author: @jannic
Created: 5/4/2017
Status: Closed

Base: masterHead: pr3


📝 Commits (1)

  • 2f0236e limit generic functions of Client to Sized types

📊 Changes

1 file changed (+6 additions, -5 deletions)

View changed files

📝 client/src/client/client.rs (+6 -5)

📄 Description

This allowes for function definitions like:

fn example<T>(client: &mut Client<T>) {
}

Without that change, such a definition fails with:

error[E0038]: the trait `trust_dns::client::Client` cannot be made into an object
   --> src/main.rs:220:1
    |
220 |   fn example<T>(client: &mut Client<T>) {
    |  _^ starting here...
221 | | }
    | |_^ ...ending here: the trait `trust_dns::client::Client` cannot be made into an object
    |
    = note: method `notify` has generic type parameters
    = note: method `create` has generic type parameters
    = note: method `append` has generic type parameters
    = note: method `compare_and_swap` has generic type parameters
    = note: method `delete_by_rdata` has generic type parameters

I'm not sure if this is really a useful use case. While playing with trust-dns I stumbled on the mentioned error message while trying to pass a client object to a function. In the end, I didn't use that function signature at all.

So feel free to merge the PR if you think it's useful, but I won't be disappointed if you just drop it.


🔄 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/124 **Author:** [@jannic](https://github.com/jannic) **Created:** 5/4/2017 **Status:** ❌ Closed **Base:** `master` ← **Head:** `pr3` --- ### 📝 Commits (1) - [`2f0236e`](https://github.com/hickory-dns/hickory-dns/commit/2f0236ece53ad36a4fb90b30f242e9aa55385d16) limit generic functions of Client to Sized types ### 📊 Changes **1 file changed** (+6 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `client/src/client/client.rs` (+6 -5) </details> ### 📄 Description This allowes for function definitions like: ``` fn example<T>(client: &mut Client<T>) { } ``` Without that change, such a definition fails with: ``` error[E0038]: the trait `trust_dns::client::Client` cannot be made into an object --> src/main.rs:220:1 | 220 | fn example<T>(client: &mut Client<T>) { | _^ starting here... 221 | | } | |_^ ...ending here: the trait `trust_dns::client::Client` cannot be made into an object | = note: method `notify` has generic type parameters = note: method `create` has generic type parameters = note: method `append` has generic type parameters = note: method `compare_and_swap` has generic type parameters = note: method `delete_by_rdata` has generic type parameters ``` I'm not sure if this is really a useful use case. While playing with trust-dns I stumbled on the mentioned error message while trying to pass a client object to a function. In the end, I didn't use that function signature at all. So feel free to merge the PR if you think it's useful, but I won't be disappointed if you just drop it. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 01:56:26 +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#1253
No description provided.