-
Notifications
You must be signed in to change notification settings - Fork 5
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
More control over case conversions? #35
Comments
Yeah that's true. Can be annoying at times. I made it like this so it's easy to copy from datasheets which are not always consistent. I want to have some global settings and the casing can be part of that. The current could be called 'best guess', but others could maybe specify that the input case is always Pascal. |
So what I've settled on now is being able to specify the word boundaries yourself fully in the global config: device-driver/generation/src/dsl_hir/mod.rs Lines 20 to 34 in 4c2a041
You can specify the boundaries as an array: https://docs.rs/convert_case/latest/convert_case/enum.Boundary.html |
Right now converting names from pascal case to snake case can lead to some undesirable word boundaries. For example
I2cSettings
turns intoi_2_c_settings
in snake case andI2CSettings
(note the capitalC
) in pascal case. I'm not sure what the best solution would be to give the user more control over those conversions. One option would be to use an unambiguous casing as the input in all cases (such as snake case). Another option would be to let the user optionally specify the casings somehow.I would consider this a pretty minor issue, but something worth thinking about; particularly if you move forward with something like #34.
The text was updated successfully, but these errors were encountered: