mirror of
https://github.com/rust-lang/rustlings.git
synced 2024-12-27 00:00:03 +03:00
Complete modules excersises
This commit is contained in:
parent
b63f6a6a9e
commit
e527943d84
|
@ -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!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -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";
|
||||||
|
|
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue