Rules
- If a module named
human
has no submodules, you should put the declaration for thehuman
in a file named human.rs - If a module named
human
does have a submodule, you should put the declarations forhuman
in a file namedhuman/mod.rs
Example
/*
src/lib.rs
*/
pub mod Human;
/*
src/human/mod.rs
*/
pub mod social;
pub mod action;
/*
src/human/social.rs
*/
pub fn have_fun(){
println!("Have fun");
}
/*
src/human/action.rs
*/
pub fn walk(){
println!("walking");
}
/*
src/main.rs
*/
use my_project_name::human;
fn main(){
human::social::have_fun();
human::action::walk();
}