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_`.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to