File compilation structure issue

the linked article by @firebits.io explains the module system very well, I can't say anything better.

main.rs is the default file name used by cargo's target auto discovery mechanism for bin crates. if you want to have multiple runnable binaries, you can either list them explicitly in the Cargo.toml manifest, or you can put the file under the src/bin directory for auto-discovery.

rust's equivalent to TU (translation unit) in C++ is called crate, which can be different types such as binary or library. when running cargo new command, it creates a package, which contains one default build target in it, each of which is a crate itself. you can have multiple targets/crates in a single package.

the terminology is explained in chapter 7 of the book:

I also explained this topic briefly in this previous answer: