santiagomed opened a new pull request, #3546:
URL: https://github.com/apache/thrift/pull/3546

   ## Problem
   
   The Rust code generator hardcodes `use crate::` for cross-file imports 
(e.g., `event.thrift` includes `trees.thrift` generates `use crate::trees;`). 
This assumes the generated files are placed at the crate root (`src/`). When 
files are placed in a submodule (e.g., `src/thrift/`), the correct prefix is 
`super::`, and users must post-process generated files with sed.
   
   ## Fix
   
   Add a `crate_prefix` generator option that controls the path prefix. Default 
remains `crate` for backward compatibility.
   
   ```bash
   # Files at crate root — existing behavior, unchanged
   thrift --gen rs -out src/ schema.thrift
   
   # Files in a submodule
   thrift --gen rs:crate_prefix=super -out src/thrift/ schema.thrift
   ```
   
   ## Changes
   
   - `t_rs_generator` constructor reads `crate_prefix` from `parsed_options`
   - `crate_prefix_` member stores the value (default: `"crate"`)
   - Import generation in `render_program_includes` uses `crate_prefix_` 
instead of hardcoded `"crate"`
   - `THRIFT_REGISTER_GENERATOR` updated to document the option


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to