Does rust support file scanning during program compilation

For example, I now have a directory code file, which needs to be scanned during the compilation period to obtain some functions, which can be understood as priority loading.

during the cargo build or cargo package cargo run

Sounds like a use case for build scripts?


Whether some source files can be compiled preferentially in advance during the compilation of the rust runtime and compilation

What do you mean?