New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rework: Enum typename considering name in enumeratedValues #627
Merged
Conversation
This file contains 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
r? @ryankurte (rust-highfive has picked a reviewer for you, use r? to override) |
rust-highfive
added
S-waiting-on-review
Status: Awaiting review from the assignee but also interested parties.
T-tools
labels
Jul 10, 2022
luojia65
force-pushed
the
enum-names
branch
3 times, most recently
from
July 11, 2022 09:07
541b2dc
to
01e2bb2
Compare
Merged
rebase, please. |
thanks, I'll rebase to adapt main branch changes. |
This pull request is a rework to rust-embedded#612; it only considers enumeration name other than writer structure and reader structure. Names to those two proxy structures are yet to be discussed. svd2rust has a good mechanism to parse enumeratedValues into Rust enums. However, current code would pick name of the first field the enum resides, and use `pub type` to re-export it into other names. SVD files provide `name` field in enumeratedValues, this commit make use of them to name the Rust enums it generated. After this commit, more information of SVD file is considered in output pac crate. Users may also discover a significant drop in amount of types, which will speed up rustdoc generation and crate compilation. This commit is tested on deriving enum from other peripherals and registers, and it uses old convention of format! macro to match the 1.51.0 minimum supported Rust version.
@burrbull: Hello! I have rebased to master and pushed my commit. |
burrbull
approved these changes
Jul 14, 2022
bors r+ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
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.
Marked as draft: this pull request depends on #626, and should be merged after that pull request is merged.Ready for review as #626 is merged.This pull request is a rework to #612; commits in this pull request only considers enumeration name other than writer structure and reader structure. Names to those two proxy structures are yet to be discussed.
svd2rust has a good mechanism to parse enumeratedValues into Rust enums. However, current code would pick name of the first field the enum resides, and use pub type to re-export it into other names.
SVD files provide
name
field in enumeratedValues, this commit make use of them to name the Rust enums it generated. After this commit, more information of SVD file is considered in output pac crate. Users may also discover a significant drop in amount of types, which will speed up rustdoc generation and crate compilation.After this pull request is merged, we can discuss on how the read proxy and write proxy should be named as is mentioned in comment at #612.
Before this pull request:
After this pull request:
SVD file for this example: