[Build Script] Use local module from generated file?

⚓ rust    📅 2025-05-15    👤 surdeus    👁️ 4      

surdeus

Warning

This post was published 46 days ago. The information described in this article may have changed.

Howdy,

I have a simple project that generates code from a grammar file. The first brace-enclosed block in that file is some rust code that is being injected verbatim into the generated Rust file. I want to move that code to a module adjacent to the grammar file and replace it with a directive to use that module. But the naïve approach makes Rust look for the module in the build script's OUT_DIR, i.e. next to the file that was generated. Is there a way to do what I want without copying or linking that file into OUT_DIR?

Thanks in advance!

1 post - 1 participant

Read full topic

🏷️ rust_feed