[
https://issues.apache.org/jira/browse/THRIFT-2945?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15822936#comment-15822936
]
ASF GitHub Bot commented on THRIFT-2945:
----------------------------------------
Github user anatol commented on a diff in the pull request:
https://github.com/apache/thrift/pull/1147#discussion_r94457731
--- Diff: compiler/cpp/src/thrift/generate/t_rs_generator.cc ---
@@ -2722,7 +2756,30 @@ string t_rs_generator::rust_namespace(t_service*
tservice) {
}
string t_rs_generator::rust_struct_name(t_struct* tstruct) {
- return rust_camel_case(tstruct->get_name());
+ string base_struct_name(rust_camel_case(tstruct->get_name()));
+ if (is_reserved(base_struct_name)) {
+ return "Res" + base_struct_name;
+ } else {
+ return base_struct_name;
+ }
+}
+
+string t_rs_generator::rust_field_name(t_field* tfield) {
+ string base_field_name(rust_snake_case(tfield->get_name()));
+ if (is_reserved(base_field_name)) {
+ return "res_" + base_field_name;
--- End diff --
"res_" prefix some might be a little bit confusing. Maybe just add "_"
prefix/suffix to the name? Compare field names: `res_type` and `type_`;
`res_func` and `func_`.
> Implement support for Rust language
> -----------------------------------
>
> Key: THRIFT-2945
> URL: https://issues.apache.org/jira/browse/THRIFT-2945
> Project: Thrift
> Issue Type: New Feature
> Components: Wish List
> Reporter: Maksim Golov
> Assignee: Jeremy Fitzhardinge
>
> Work on implementing support for Rust is in progress:
> https://github.com/maximg/thrift by Simon Génier and myself.
> It will probably take quite some time to complete. Please keep us updated if
> there are changes related to our work.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)