modules1.rs (329B)
1 mod sausage_factory { 2 fn get_secret_recipe() -> String { 3 String::from("Ginger") 4 } 5 6 // Added `pub` before `fn` to make the function accessible outside the module. 7 pub fn make_sausage() { 8 get_secret_recipe(); 9 println!("sausage!"); 10 } 11 } 12 13 fn main() { 14 sausage_factory::make_sausage(); 15 }