aboutsummaryrefslogtreecommitdiffstats
path: root/rustlings/solutions/10_modules/modules1.rs
diff options
context:
space:
mode:
authorHunter Kvalevog <hunter@kvog.sh>2026-09-27 10:42:27 -0500
committerHunter Kvalevog <hunter@kvog.sh>2026-09-27 10:42:27 -0500
commit1b413350c46f8214785e179f60693b78a9bb5f2f (patch)
tree2ce9ca80401d59e2bb7bab1b229ce79d0292cc25 /rustlings/solutions/10_modules/modules1.rs
parentac9620e5e0720bdb3f6c11c84d660a79f1ca7bc5 (diff)
downloaddemos-1b413350c46f8214785e179f60693b78a9bb5f2f.tar.gz
demos-1b413350c46f8214785e179f60693b78a9bb5f2f.zip
Diffstat (limited to 'rustlings/solutions/10_modules/modules1.rs')
-rw-r--r--rustlings/solutions/10_modules/modules1.rs15
1 files changed, 13 insertions, 2 deletions
diff --git a/rustlings/solutions/10_modules/modules1.rs b/rustlings/solutions/10_modules/modules1.rs
index dcf2377..873b412 100644
--- a/rustlings/solutions/10_modules/modules1.rs
+++ b/rustlings/solutions/10_modules/modules1.rs
@@ -1,4 +1,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() {
- // DON'T EDIT THIS SOLUTION FILE!
- // It will be automatically filled after you finish the exercise.
+ sausage_factory::make_sausage();
}