2023-05-29 18:39:08 +01:00
|
|
|
// You can bring module paths into scopes and provide new names for them with
|
2024-06-22 12:24:06 +01:00
|
|
|
// the `use` and `as` keywords.
|
2015-09-18 03:21:56 +01:00
|
|
|
|
2019-06-07 03:52:42 +01:00
|
|
|
mod delicious_snacks {
|
2024-06-26 01:26:04 +01:00
|
|
|
// TODO: Add the following two `use` statements after fixing them.
|
2024-06-22 12:24:06 +01:00
|
|
|
// use self::fruits::PEAR as ???;
|
|
|
|
// use self::veggies::CUCUMBER as ???;
|
2015-09-18 03:21:56 +01:00
|
|
|
|
2019-01-23 20:56:05 +00:00
|
|
|
mod fruits {
|
2024-06-22 12:24:06 +01:00
|
|
|
pub const PEAR: &str = "Pear";
|
|
|
|
pub const APPLE: &str = "Apple";
|
2015-09-18 03:21:56 +01:00
|
|
|
}
|
|
|
|
|
2019-01-23 20:56:05 +00:00
|
|
|
mod veggies {
|
2024-06-22 12:24:06 +01:00
|
|
|
pub const CUCUMBER: &str = "Cucumber";
|
|
|
|
pub const CARROT: &str = "Carrot";
|
2015-09-18 03:21:56 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2019-06-07 03:52:42 +01:00
|
|
|
println!(
|
|
|
|
"favorite snacks: {} and {}",
|
|
|
|
delicious_snacks::fruit,
|
2024-06-22 12:24:06 +01:00
|
|
|
delicious_snacks::veggie,
|
2019-06-07 03:52:42 +01:00
|
|
|
);
|
2015-09-18 03:21:56 +01:00
|
|
|
}
|