[GH-ISSUE #2511] feat(serde-config)[proto]: Message is not deriving Serialize/Deserialize #1008

Open
opened 2026-03-16 01:15:21 +03:00 by kerem · 5 comments
Owner

Originally created by @ArjixWasTaken on GitHub (Oct 16, 2024).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2511

About

One would expect having the feature serde-config enabled, would make all important structs be serializable/deserializable.
Sadly that is not the reality, the following types do not derive the needed macros.

  • Message
  • Header
  • Edns
  • Query
  • MessageType
  • OpCode
  • ResponseCode

Reproduction

Attempt to serialize a Message using serde.

Expected behavior

For serde to be able to serialize Message.

Version:

Crate: proto
Version: 0.24.1

Originally created by @ArjixWasTaken on GitHub (Oct 16, 2024). Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2511 ## About One would expect having the feature `serde-config` enabled, would make all important structs be serializable/deserializable. Sadly that is not the reality, the following types do not derive the needed macros. - `Message` - `Header` - `Edns` - `Query` - `MessageType` - `OpCode` - `ResponseCode` ## Reproduction Attempt to serialize a `Message` using serde. ## Expected behavior For serde to be able to serialize `Message`. ## Version: Crate: proto Version: 0.24.1
Author
Owner

@ArjixWasTaken commented on GitHub (Oct 16, 2024):

For now I can sort-off go around this issue by having a 1:1 clone of those structs, and implement conversion functions.
It ain't pretty
image

--

image

<!-- gh-comment-id:2416997255 --> @ArjixWasTaken commented on GitHub (Oct 16, 2024): For now I can sort-off go around this issue by having a 1:1 clone of those structs, and implement conversion functions. It ain't pretty ![image](https://github.com/user-attachments/assets/074a81d4-4f66-4415-b047-74e90aafd6f6) -- ![image](https://github.com/user-attachments/assets/1279e8d5-3c4a-474f-a547-b85e27614fab)
Author
Owner

@djc commented on GitHub (Oct 16, 2024):

Well, these types really don't fit the mold of -config specifically. Perhaps we should generalize to a serde flag more broadly, but your use case seems pretty niche.

<!-- gh-comment-id:2417015906 --> @djc commented on GitHub (Oct 16, 2024): Well, these types really don't fit the mold of `-config` specifically. Perhaps we should generalize to a `serde` flag more broadly, but your use case seems pretty niche.
Author
Owner

@ArjixWasTaken commented on GitHub (Oct 16, 2024):

Could you entertain me as to what the postfix -config means in the project?

<!-- gh-comment-id:2417023883 --> @ArjixWasTaken commented on GitHub (Oct 16, 2024): Could you entertain me as to what the postfix `-config` means in the project?
Author
Owner

@djc commented on GitHub (Oct 16, 2024):

AIUI serde-config is mainly used to enable TOML configuration in the main hickory-dns binary crate.

<!-- gh-comment-id:2417048987 --> @djc commented on GitHub (Oct 16, 2024): AIUI `serde-config` is mainly used to enable TOML configuration in the main hickory-dns binary crate.
Author
Owner

@ArjixWasTaken commented on GitHub (Oct 16, 2024):

I see, that makes a lot of sense.
A general serde feature would be nice to have.

<!-- gh-comment-id:2417076033 --> @ArjixWasTaken commented on GitHub (Oct 16, 2024): I see, that makes a lot of sense. A general `serde` feature would be nice to have.
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#1008
No description provided.