Going through rustlings for the first time
at main 532 B view raw
1mod delicious_snacks { 2 // Added `pub` and used the expected alias after `as`. 3 pub use self::fruits::PEAR as fruit; 4 pub use self::veggies::CUCUMBER as veggie; 5 6 mod fruits { 7 pub const PEAR: &str = "Pear"; 8 pub const APPLE: &str = "Apple"; 9 } 10 11 mod veggies { 12 pub const CUCUMBER: &str = "Cucumber"; 13 pub const CARROT: &str = "Carrot"; 14 } 15} 16 17fn main() { 18 println!( 19 "favorite snacks: {} and {}", 20 delicious_snacks::fruit, 21 delicious_snacks::veggie, 22 ); 23}