[PR #1397] [MERGED] proto: add into_parts methods #2286

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

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/1397
Author: @leshow
Created: 3/1/2021
Status: Merged
Merged: 3/8/2021
Merged by: @bluejekyll

Base: mainHead: proto_into_parts


📝 Commits (8)

  • d4259aa proto: add into_parts methods
  • 8bffa2a proto: deprecate options() for OPT
  • b272a40 proto: use XParts types in public API
  • d2708ec proto: fix cargo destructure
  • 830f05e proto: use cfg_if
  • 74c28e5 proto: fix lint"
  • 8e5f4be proto: attempt to satisfy CI
  • ab0fdd0 add clone to digest

📊 Changes

16 files changed (+236 additions, -16 deletions)

View changed files

📝 crates/client/src/error/dnssec_error.rs (+3 -3)
📝 crates/proto/src/error.rs (+2 -2)
📝 crates/proto/src/lib.rs (+2 -0)
📝 crates/proto/src/op/header.rs (+1 -1)
📝 crates/proto/src/op/message.rs (+56 -1)
📝 crates/proto/src/op/query.rs (+49 -0)
📝 crates/proto/src/rr/dnssec/ec_public_key.rs (+1 -0)
📝 crates/proto/src/rr/dnssec/mod.rs (+1 -0)
📝 crates/proto/src/rr/rdata/opt.rs (+14 -1)
📝 crates/proto/src/rr/resource.rs (+58 -0)
📝 crates/proto/src/rr/rr_set.rs (+41 -0)
📝 crates/proto/src/xfer/dns_request.rs (+1 -1)
📝 crates/proto/src/xfer/dns_response.rs (+1 -1)
📝 crates/resolver/src/caching_client.rs (+1 -1)
📝 crates/resolver/src/lookup.rs (+2 -2)
📝 crates/resolver/src/lookup_ip.rs (+3 -3)

📄 Description

summary:

  • Header is Copy
    - options_mut added to OPT (I had wanted this before but for some reason forgot to add it)
  • AsMut/AsRef added to OPT
  • into_parts methods added to Message Record Query RData -- these methods are useful for us because we want to consume a Message after we're done processing and transform it into a log struct, however we can only clone data currently.

It occurred to me that it might be nice to have into_ascii that consumes self and returns a String as well as to_ascii for Name and Label. I have not added these here as I'm not sure if it's possible yet. Any thoughts?


🔄 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/1397 **Author:** [@leshow](https://github.com/leshow) **Created:** 3/1/2021 **Status:** ✅ Merged **Merged:** 3/8/2021 **Merged by:** [@bluejekyll](https://github.com/bluejekyll) **Base:** `main` ← **Head:** `proto_into_parts` --- ### 📝 Commits (8) - [`d4259aa`](https://github.com/hickory-dns/hickory-dns/commit/d4259aaf68d43177f690008425571660ab851fef) proto: add into_parts methods - [`8bffa2a`](https://github.com/hickory-dns/hickory-dns/commit/8bffa2a5d645b40307b27b3777a77cd2af29ffa3) proto: deprecate options() for OPT - [`b272a40`](https://github.com/hickory-dns/hickory-dns/commit/b272a40fea2c08e3c2c6022373e097a39ff0aa96) proto: use XParts types in public API - [`d2708ec`](https://github.com/hickory-dns/hickory-dns/commit/d2708ec62a9e0dc293930ca94b925ee6422059a5) proto: fix cargo destructure - [`830f05e`](https://github.com/hickory-dns/hickory-dns/commit/830f05e675a356a7375e6d512c8762da69521eb0) proto: use cfg_if - [`74c28e5`](https://github.com/hickory-dns/hickory-dns/commit/74c28e5f9650dddfa9cbd607e55142dc8ebd6336) proto: fix lint" - [`8e5f4be`](https://github.com/hickory-dns/hickory-dns/commit/8e5f4bebcc09db96346fc66c0278f5369b58508c) proto: attempt to satisfy CI - [`ab0fdd0`](https://github.com/hickory-dns/hickory-dns/commit/ab0fdd0a6e6e1e6b89c5f821265bee62f097d572) add clone to digest ### 📊 Changes **16 files changed** (+236 additions, -16 deletions) <details> <summary>View changed files</summary> 📝 `crates/client/src/error/dnssec_error.rs` (+3 -3) 📝 `crates/proto/src/error.rs` (+2 -2) 📝 `crates/proto/src/lib.rs` (+2 -0) 📝 `crates/proto/src/op/header.rs` (+1 -1) 📝 `crates/proto/src/op/message.rs` (+56 -1) 📝 `crates/proto/src/op/query.rs` (+49 -0) 📝 `crates/proto/src/rr/dnssec/ec_public_key.rs` (+1 -0) 📝 `crates/proto/src/rr/dnssec/mod.rs` (+1 -0) 📝 `crates/proto/src/rr/rdata/opt.rs` (+14 -1) 📝 `crates/proto/src/rr/resource.rs` (+58 -0) 📝 `crates/proto/src/rr/rr_set.rs` (+41 -0) 📝 `crates/proto/src/xfer/dns_request.rs` (+1 -1) 📝 `crates/proto/src/xfer/dns_response.rs` (+1 -1) 📝 `crates/resolver/src/caching_client.rs` (+1 -1) 📝 `crates/resolver/src/lookup.rs` (+2 -2) 📝 `crates/resolver/src/lookup_ip.rs` (+3 -3) </details> ### 📄 Description summary: - `Header` is `Copy` ~~- `options_mut` added to `OPT` (I had wanted this before but for some reason forgot to add it)~~ - `AsMut`/`AsRef` added to `OPT` - `into_parts` methods added to `Message` `Record` `Query` `RData` -- these methods are useful for us because we want to consume a `Message` after we're done processing and transform it into a log struct, however we can only clone data currently. It occurred to me that it might be nice to have `into_ascii` that consumes `self` and returns a `String` as well as `to_ascii` for `Name` and `Label`. I have not added these here as I'm not sure if it's possible yet. Any thoughts? --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 08:45:38 +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#2286
No description provided.