Complete modules excersises

This commit is contained in:
Suzie Kim 2024-01-31 17:36:35 -05:00
parent b63f6a6a9e
commit e527943d84
No known key found for this signature in database
GPG key ID: 83C4CC3808F9AAE9
3 changed files with 8 additions and 10 deletions

View file

@ -3,15 +3,13 @@
// Execute `rustlings hint modules1` or use the `hint` watch subcommand for a // Execute `rustlings hint modules1` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
mod sausage_factory { mod sausage_factory {
// Don't let anybody outside of this module see this! // Don't let anybody outside of this module see this!
fn get_secret_recipe() -> String { fn get_secret_recipe() -> String {
String::from("Ginger") String::from("Ginger")
} }
fn make_sausage() { pub fn make_sausage() {
get_secret_recipe(); get_secret_recipe();
println!("sausage!"); println!("sausage!");
} }

View file

@ -7,12 +7,10 @@
// Execute `rustlings hint modules2` or use the `hint` watch subcommand for a // Execute `rustlings hint modules2` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
mod delicious_snacks { mod delicious_snacks {
// TODO: Fix these use statements // TODO: Fix these use statements
use self::fruits::PEAR as ??? pub use self::fruits::PEAR as fruit;
use self::veggies::CUCUMBER as ??? pub use self::veggies::CUCUMBER as veggie;
mod fruits { mod fruits {
pub const PEAR: &'static str = "Pear"; pub const PEAR: &'static str = "Pear";

View file

@ -8,10 +8,12 @@
// Execute `rustlings hint modules3` or use the `hint` watch subcommand for a // Execute `rustlings hint modules3` or use the `hint` watch subcommand for a
// hint. // hint.
// I AM NOT DONE
// TODO: Complete this use statement // TODO: Complete this use statement
use ??? // The * is a glob operator. It imports all public items from the module.
// use std::time::*;
// You can also write a nested path to specify the public items you want to pull in.
use std::time::{SystemTime, UNIX_EPOCH};
fn main() { fn main() {
match SystemTime::now().duration_since(UNIX_EPOCH) { match SystemTime::now().duration_since(UNIX_EPOCH) {