summaryrefslogtreecommitdiff
path: root/solutions/10_modules
diff options
context:
space:
mode:
authormo8it <mo8it@proton.me>2024-06-22 13:12:39 +0200
committermo8it <mo8it@proton.me>2024-06-22 13:12:39 +0200
commitecbe9b7324364e94f7c6b4a4dd279fb90f5a938e (patch)
tree3c6524c9c8f3fd59429c9babe63a30b61c985ad0 /solutions/10_modules
parent879f0cd5c69b8b0bf93da036d31334f9757bf6a3 (diff)
modules1 solution
Diffstat (limited to 'solutions/10_modules')
-rw-r--r--solutions/10_modules/modules1.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/solutions/10_modules/modules1.rs b/solutions/10_modules/modules1.rs
index 4e18198..873b412 100644
--- a/solutions/10_modules/modules1.rs
+++ b/solutions/10_modules/modules1.rs
@@ -1 +1,15 @@
-// Solutions will be available before the stable release. Thank you for testing the beta version 🥰
+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();
+}