···55 // TODO: Add the following two `use` statements after fixing them.
66 // use self::fruits::PEAR as ???;
77 // use self::veggies::CUCUMBER as ???;
88+ pub use self::fruits::PEAR as fruit;
99+ pub use self::veggies::CUCUMBER as veggie;
810911 mod fruits {
1012 pub const PEAR: &str = "Pear";
+1
exercises/10_modules/modules3.rs
···44// TODO: Bring `SystemTime` and `UNIX_EPOCH` from the `std::time` module into
55// your scope. Bonus style points if you can do it with one line!
66// use ???;
77+use std::time::{SystemTime, UNIX_EPOCH};
7889fn main() {
910 match SystemTime::now().duration_since(UNIX_EPOCH) {
+13-2
solutions/10_modules/modules1.rs
···11+mod sausage_factory {
22+ fn get_secret_recipe() -> String {
33+ String::from("Ginger")
44+ }
55+66+ // Added `pub` before `fn` to make the function accessible outside the module.
77+ pub fn make_sausage() {
88+ get_secret_recipe();
99+ println!("sausage!");
1010+ }
1111+}
1212+113fn main() {
22- // DON'T EDIT THIS SOLUTION FILE!
33- // It will be automatically filled after you finish the exercise.
1414+ sausage_factory::make_sausage();
415}
+21-2
solutions/10_modules/modules2.rs
···11+mod delicious_snacks {
22+ // Added `pub` and used the expected alias after `as`.
33+ pub use self::fruits::PEAR as fruit;
44+ pub use self::veggies::CUCUMBER as veggie;
55+66+ mod fruits {
77+ pub const PEAR: &str = "Pear";
88+ pub const APPLE: &str = "Apple";
99+ }
1010+1111+ mod veggies {
1212+ pub const CUCUMBER: &str = "Cucumber";
1313+ pub const CARROT: &str = "Carrot";
1414+ }
1515+}
1616+117fn main() {
22- // DON'T EDIT THIS SOLUTION FILE!
33- // It will be automatically filled after you finish the exercise.
1818+ println!(
1919+ "favorite snacks: {} and {}",
2020+ delicious_snacks::fruit,
2121+ delicious_snacks::veggie,
2222+ );
423}
+6-2
solutions/10_modules/modules3.rs
···11+use std::time::{SystemTime, UNIX_EPOCH};
22+13fn main() {
22- // DON'T EDIT THIS SOLUTION FILE!
33- // It will be automatically filled after you finish the exercise.
44+ match SystemTime::now().duration_since(UNIX_EPOCH) {
55+ Ok(n) => println!("1970-01-01 00:00:00 UTC was {} seconds ago!", n.as_secs()),
66+ Err(_) => panic!("SystemTime before UNIX EPOCH!"),
77+ }
48}