mod.rs is the directory entry point that turns grouped Rust source files into a module. In a reorganized web application, handlers, models, and database-access code each receive a directory and a mod.rs file so the compiler can locate dependent files. section 6.1
Declaring child modules
A models/mod.rs file can declare its children with `pub mod course;` and `pub mod tutor;`. Code elsewhere can then import a type through `use crate::models::course::Course;`. A handlers/mod.rs similarly declares `course`, `tutor`, and `general`.
A directory-based module structure can separate:
- handlers/mod.rs from course.rs, tutor.rs, and general.rs section 6.1
- models/mod.rs from course.rs and tutor.rs section 6.1
- dbaccess/mod.rs from course.rs and tutor.rs section 6.1
