mirror of
https://github.com/rust-lang/rustlings.git
synced 2026-01-11 05:09:19 +00:00
module done
This commit is contained in:
parent
ef264b86e4
commit
8eb8525699
@ -1,7 +1,6 @@
|
|||||||
// modules1.rs
|
// modules1.rs
|
||||||
// Make me compile! Execute `rustlings hint modules1` for hints :)
|
// Make me compile! Execute `rustlings hint modules1` for hints :)
|
||||||
|
|
||||||
// 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!
|
||||||
@ -9,7 +8,7 @@ mod sausage_factory {
|
|||||||
String::from("Ginger")
|
String::from("Ginger")
|
||||||
}
|
}
|
||||||
|
|
||||||
fn make_sausage() {
|
pub fn make_sausage() {
|
||||||
get_secret_recipe();
|
get_secret_recipe();
|
||||||
println!("sausage!");
|
println!("sausage!");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,26 +3,26 @@
|
|||||||
// 'use' and 'as' keywords. Fix these 'use' statements to make the code compile.
|
// 'use' and 'as' keywords. Fix these 'use' statements to make the code compile.
|
||||||
// Make me compile! Execute `rustlings hint modules2` for hints :)
|
// Make me compile! Execute `rustlings hint modules2` for hints :)
|
||||||
|
|
||||||
// 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 {
|
pub mod fruits {
|
||||||
pub const PEAR: &'static str = "Pear";
|
pub const PEAR: &'static str = "Pear";
|
||||||
pub const APPLE: &'static str = "Apple";
|
pub const APPLE: &'static str = "Apple";
|
||||||
}
|
}
|
||||||
|
|
||||||
mod veggies {
|
pub mod veggies {
|
||||||
pub const CUCUMBER: &'static str = "Cucumber";
|
pub const CUCUMBER: &'static str = "Cucumber";
|
||||||
pub const CARROT: &'static str = "Carrot";
|
pub const CARROT: &'static str = "Carrot";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
let t=12;
|
||||||
println!(
|
println!(
|
||||||
"favorite snacks: {} and {}",
|
"favorite snacks: {} and {}",
|
||||||
delicious_snacks::fruit,
|
delicious_snacks::fruit,
|
||||||
|
|||||||
@ -5,10 +5,9 @@
|
|||||||
// from the std::time module. Bonus style points if you can do it with one line!
|
// 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 :)
|
// Make me compile! Execute `rustlings hint modules3` for hints :)
|
||||||
|
|
||||||
// I AM NOT DONE
|
|
||||||
|
|
||||||
// TODO: Complete this use statement
|
// TODO: Complete this use statement
|
||||||
use ???
|
use std::time::{SystemTime, UNIX_EPOCH};
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
match SystemTime::now().duration_since(UNIX_EPOCH) {
|
match SystemTime::now().duration_since(UNIX_EPOCH) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user