Better reflect::Struct field unpacking#662
Merged
Merged
Conversation
Merged
df309fa to
6a02ee1
Compare
c7878a4 to
4bad0ff
Compare
6a02ee1 to
b9e0537
Compare
4bad0ff to
1469947
Compare
b9e0537 to
c1f68b4
Compare
5c809af to
856c262
Compare
c1f68b4 to
57d5f1c
Compare
57d5f1c to
9950776
Compare
7f67b46 to
bb9d369
Compare
Contributor
Author
|
Tested on (in fact, I had messed up one of the counter array sizes) |
labbott
approved these changes
May 20, 2026
bb9d369 to
327fc04
Compare
9950776 to
3021c11
Compare
There was a problem hiding this comment.
Pull request overview
This PR improves reflected struct/tuple field access by adding Struct::field / Tuple::field helpers that deserialize strongly-typed members via Load, and then updates downstream call sites to use the new API.
Changes:
- Add
Struct::field/Tuple::fieldtyped accessors inhumility-core::reflect, plus newLoadimpls (e.g., forStruct,Tuple,Base,()). - Refactor SPD parsing to use typed field extraction for nested SPD buffers.
- Refactor
netcommand decoding (MAC address, link status, counters) to use typed field extraction.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| humility-spd/src/lib.rs | Simplifies nested SPD buffer unpacking using Struct::field. |
| humility-core/src/reflect.rs | Introduces typed field helpers and additional Load impls; tweaks a field lookup error string. |
| cmd/net/src/lib.rs | Replaces manual reflected decoding with Struct::field / Tuple::field in several command paths. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
327fc04 to
e0f22cf
Compare
3021c11 to
d2b73a4
Compare
e0f22cf to
2740bf7
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
(staged on #658)
Adds a
Struct::fieldfunction which unpacks a strongly-typed field, then uses it in relevant places.