I'm new to Rust and have written a few command line utilities so far. I'm starting to write things that require more code and I'm trying to figure out how to split up my code. So far, what I've done is something like this:
src/ main.rs mod1.rs mod2.rs
This works fine as all I have to do in
main.rs is include
mod mod1 and I have access to the public structs/functions. However, my modules files (
mod2.rs in this fictional example) are getting large enough that I'd like to break them up into separate files but include them in their own directories like this:
src/ main.rs mod1/ mod1_structs.rs mod1_functions.rs mod2/ mod2_structs.rs mod2_functions.rs
In this case, including
mod mod1; won't work in
main.rs. How is this normally handled in Rust?
Thanks so much in advance!