Skip to content

Commit b537dca

Browse files
committed
Rework: Enum typename considering name in enumeratedValues
This pull request is a rework to #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.
1 parent 4522976 commit b537dca

File tree

2 files changed

+265
-217
lines changed

2 files changed

+265
-217
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
77

88
## [Unreleased]
99

10+
- Generated enum names now consider `name` field in `enumeratedValues`
1011
- Use constant case for structure names; internal rearrangements for
1112
case conversation traits
1213
- Add new feature `feature_group` which will generate cfg attribute for

0 commit comments

Comments
 (0)