lib.rs (938B)
1 pub mod front_of_house; 2 3 pub mod back_of_house { 4 pub enum Appetizer { 5 Soup, 6 Salad, 7 } 8 9 pub struct Breakfast { 10 pub toast: String, 11 fruit: String, 12 } 13 14 impl Breakfast { 15 pub fn summer(toast: &str) -> Breakfast { 16 Breakfast { 17 toast: String::from(toast), 18 fruit: String::from("peaches"), 19 } 20 } 21 } 22 23 pub fn fix_order () { 24 cook_order(); 25 super::front_of_house::serving::serve_order(); 26 } 27 28 fn cook_order() {} 29 } 30 31 pub fn eat_at_restaurant() { 32 use front_of_house::hosting; 33 use back_of_house::fix_order as fix; 34 fix(); 35 hosting::add_to_waitlist(); 36 37 let mut meal = back_of_house::Breakfast::summer("rye"); 38 meal.toast = String::from("brown"); 39 40 let order1 = back_of_house::Appetizer::Soup; 41 let order2 = back_of_house::Appetizer::Salad; 42 // meal.fruit = String::from("kiwi"); 43 }