Closed luojia65 closed 2 years ago
r? @ryankurte
(rust-highfive has picked a reviewer for you, use r? to override)
rebase, please. You can use last commit from https://github.com/rust-embedded/svd2rust/commits/enum-names2
thanks, I'll rebase to adapt main branch changes.
@burrbull: Hello! I have rebased to master and pushed my commit.
@burrbull: Hello! I have rebased to master and pushed my commit.
Thanks. Could you also look at GD32 https://github.com/rust-embedded/svd2rust/pull/628 ? Possibly you have idea how to fix it.
bors r+
~Marked as draft: this pull request depends on https://github.com/rust-embedded/svd2rust/pull/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 https://github.com/rust-embedded/svd2rust/pull/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: