You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Identifiers in the Smithy models are mapped to identifiers in Rust via SymbolProviders.
The details of this mapping are not formally described. Perhaps the simplest proposal is to preserve all identifiers modulo escaping reserved words. This should be the subject of an RFC.
A mapping is said to be collision free if it maps no two elements to the same output.
Topics
Should this be configurable?
The BNF for Rust identifiers vs the BNF for Smithy identifiers
What should be the exact behavior of escaping reserved words? Is this collision free?
enum variants in Rust are PascalCase, whereas Smithy enum variants are SCREAMING_SNAKE_CASE.
Pros/Cons of preserving the identifiers:
General AWS documentation uses the model identifiers.
Prior art e.g. what do other code generators do? bindgen, tonic etc.
Simplicity?
Conflict free?
Breaking change
Can make Rust code look ugly
If such a scheme does include conflicts they should be classified and documented.
Are there cases where we 100% don't want to preserve identifiers? For example operation names to setters (snake_case). In this scenario can we prevent collisions?
Methods to ensure that developers stick to guidelines.
Forbid ToString on the type level?
Lint to catch such conversions?
rustTemplate prohibits string interpolation?
The text was updated successfully, but these errors were encountered:
Identifiers in the Smithy models are mapped to identifiers in Rust via
SymbolProvider
s.The details of this mapping are not formally described. Perhaps the simplest proposal is to preserve all identifiers modulo escaping reserved words. This should be the subject of an RFC.
A mapping is said to be collision free if it maps no two elements to the same output.
Topics
enum
variants in Rust are PascalCase, whereas Smithy enum variants are SCREAMING_SNAKE_CASE.bindgen
,tonic
etc.ToString
on the type level?rustTemplate
prohibits string interpolation?The text was updated successfully, but these errors were encountered: