summaryrefslogtreecommitdiff
path: root/solutions/10_modules/modules1.rs
blob: 873b4127e6d13335df3d56ae65c73464bc9f351d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mod sausage_factory {
    fn get_secret_recipe() -> String {
        String::from("Ginger")
    }

    // Added `pub` before `fn` to make the function accessible outside the module.
    pub fn make_sausage() {
        get_secret_recipe();
        println!("sausage!");
    }
}

fn main() {
    sausage_factory::make_sausage();
}