From 8eb8525699d9ad7189271297e371f86b50e9ae7a Mon Sep 17 00:00:00 2001 From: blacktoast Date: Tue, 12 Oct 2021 07:28:26 +0000 Subject: [PATCH] module done --- exercises/modules/modules1.rs | 3 +-- exercises/modules/modules2.rs | 10 +++++----- exercises/modules/modules3.rs | 3 +-- 3 files changed, 7 insertions(+), 9 deletions(-) diff --git a/exercises/modules/modules1.rs b/exercises/modules/modules1.rs index 1a2bd0dd..2bfff9bb 100644 --- a/exercises/modules/modules1.rs +++ b/exercises/modules/modules1.rs @@ -1,7 +1,6 @@ // modules1.rs // Make me compile! Execute `rustlings hint modules1` for hints :) -// I AM NOT DONE mod sausage_factory { // Don't let anybody outside of this module see this! @@ -9,7 +8,7 @@ mod sausage_factory { String::from("Ginger") } - fn make_sausage() { + pub fn make_sausage() { get_secret_recipe(); println!("sausage!"); } diff --git a/exercises/modules/modules2.rs b/exercises/modules/modules2.rs index 87f0c458..88b5385a 100644 --- a/exercises/modules/modules2.rs +++ b/exercises/modules/modules2.rs @@ -3,26 +3,26 @@ // 'use' and 'as' keywords. Fix these 'use' statements to make the code compile. // Make me compile! Execute `rustlings hint modules2` for hints :) -// I AM NOT DONE mod delicious_snacks { // TODO: Fix these use statements - use self::fruits::PEAR as ??? - use self::veggies::CUCUMBER as ??? + pub use self::fruits::PEAR as fruit; + pub use self::veggies::CUCUMBER as veggie; - mod fruits { + pub mod fruits { pub const PEAR: &'static str = "Pear"; pub const APPLE: &'static str = "Apple"; } - mod veggies { + pub mod veggies { pub const CUCUMBER: &'static str = "Cucumber"; pub const CARROT: &'static str = "Carrot"; } } fn main() { + let t=12; println!( "favorite snacks: {} and {}", delicious_snacks::fruit, diff --git a/exercises/modules/modules3.rs b/exercises/modules/modules3.rs index 8eed77df..7e78190d 100644 --- a/exercises/modules/modules3.rs +++ b/exercises/modules/modules3.rs @@ -5,10 +5,9 @@ // from the std::time module. Bonus style points if you can do it with one line! // Make me compile! Execute `rustlings hint modules3` for hints :) -// I AM NOT DONE // TODO: Complete this use statement -use ??? +use std::time::{SystemTime, UNIX_EPOCH}; fn main() { match SystemTime::now().duration_since(UNIX_EPOCH) {