How to expose all .rs files in mod.rs?

I have the following structure:

proto_rust/src/lib.rs
proto_rust/src/protos/{lots of auto generated .rs files}
proto_rust/src/protos/mod.rs

Since there are lots of auto generated files on proto_rust/src/protos/, it does not make sense for me to put them manually in mod.rs. Is there a way to expose all them to lib.rs? Something like pub mod *

PS: files are generated from protobuf so there could be a lot and it could grow with time. On C++ and Dart it's already working for all of them, now I need Rust.

You can also auto generate the mod.rs, because why not?

$ ls src/protos/ | sed 's/./ /' | awk '{ print "pub mod "$1";" }' > src/protos/mod.rs
3 Likes

Something like automod?