diff options
| author | Adam Brewer <adamhb321@gmail.com> | 2023-10-16 07:37:12 -0400 |
|---|---|---|
| committer | Adam Brewer <adamhb321@gmail.com> | 2023-10-16 07:37:12 -0400 |
| commit | 64d95837e9813541cf5b357de13865ce687ae98d (patch) | |
| tree | f022c5d5ba01128811c0b77618a7adb843ee876b /exercises/modules | |
| parent | c3941323e2c0b9ee286494327de92e00f23b9e3a (diff) | |
Update Exercises Directory Names to Reflect Order
Diffstat (limited to 'exercises/modules')
| -rw-r--r-- | exercises/modules/README.md | 7 | ||||
| -rw-r--r-- | exercises/modules/modules1.rs | 22 | ||||
| -rw-r--r-- | exercises/modules/modules2.rs | 34 | ||||
| -rw-r--r-- | exercises/modules/modules3.rs | 21 |
4 files changed, 0 insertions, 84 deletions
diff --git a/exercises/modules/README.md b/exercises/modules/README.md deleted file mode 100644 index 3dc8a48..0000000 --- a/exercises/modules/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# Modules - -In this section we'll give you an introduction to Rust's module system. - -## Further information - -- [The Module System](https://doc.rust-lang.org/book/ch07-00-managing-growing-projects-with-packages-crates-and-modules.html) diff --git a/exercises/modules/modules1.rs b/exercises/modules/modules1.rs deleted file mode 100644 index 9eb5a48..0000000 --- a/exercises/modules/modules1.rs +++ /dev/null @@ -1,22 +0,0 @@ -// modules1.rs -// -// Execute `rustlings hint modules1` or use the `hint` watch subcommand for a -// hint. - -// I AM NOT DONE - -mod sausage_factory { - // Don't let anybody outside of this module see this! - fn get_secret_recipe() -> String { - String::from("Ginger") - } - - fn make_sausage() { - get_secret_recipe(); - println!("sausage!"); - } -} - -fn main() { - sausage_factory::make_sausage(); -} diff --git a/exercises/modules/modules2.rs b/exercises/modules/modules2.rs deleted file mode 100644 index 0415454..0000000 --- a/exercises/modules/modules2.rs +++ /dev/null @@ -1,34 +0,0 @@ -// modules2.rs -// -// You can bring module paths into scopes and provide new names for them with -// the 'use' and 'as' keywords. Fix these 'use' statements to make the code -// compile. -// -// Execute `rustlings hint modules2` or use the `hint` watch subcommand for a -// hint. - -// I AM NOT DONE - -mod delicious_snacks { - // TODO: Fix these use statements - use self::fruits::PEAR as ??? - use self::veggies::CUCUMBER as ??? - - mod fruits { - pub const PEAR: &'static str = "Pear"; - pub const APPLE: &'static str = "Apple"; - } - - mod veggies { - pub const CUCUMBER: &'static str = "Cucumber"; - pub const CARROT: &'static str = "Carrot"; - } -} - -fn main() { - println!( - "favorite snacks: {} and {}", - delicious_snacks::fruit, - delicious_snacks::veggie - ); -} diff --git a/exercises/modules/modules3.rs b/exercises/modules/modules3.rs deleted file mode 100644 index f2bb050..0000000 --- a/exercises/modules/modules3.rs +++ /dev/null @@ -1,21 +0,0 @@ -// modules3.rs -// -// You can use the 'use' keyword to bring module paths from modules from -// anywhere and especially from the Rust standard library into your scope. Bring -// SystemTime and UNIX_EPOCH from the std::time module. Bonus style points if -// you can do it with one line! -// -// Execute `rustlings hint modules3` or use the `hint` watch subcommand for a -// hint. - -// I AM NOT DONE - -// TODO: Complete this use statement -use ??? - -fn main() { - match SystemTime::now().duration_since(UNIX_EPOCH) { - Ok(n) => println!("1970-01-01 00:00:00 UTC was {} seconds ago!", n.as_secs()), - Err(_) => panic!("SystemTime before UNIX EPOCH!"), - } -} |
