1
0
Fork 0
mirror of https://github.com/notohh/rustlings.git synced 2024-12-26 20:18:08 -05:00
rustlings/solutions/10_modules/modules1.rs

16 lines
329 B
Rust
Raw Normal View History

2024-06-22 07:12:39 -04:00
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();
}