49 lines
1.1 KiB
Rust
49 lines
1.1 KiB
Rust
pub mod front_of_house {
|
|
pub mod hosting {
|
|
pub fn add_to_waitlist() {}
|
|
pub fn seat_at_table() {}
|
|
}
|
|
pub mod serving {
|
|
pub fn take_order() {}
|
|
pub fn serve_order() {}
|
|
pub fn take_payent() {}
|
|
}
|
|
}
|
|
fn deliver_order() {}
|
|
|
|
mod back_of_house {
|
|
pub struct Breakfast {
|
|
pub toast: String,
|
|
seasonal_fruit: String,
|
|
}
|
|
pub enum Appetizer {
|
|
Soup,
|
|
Salad,
|
|
}
|
|
impl Breakfast {
|
|
pub fn summer(toast: &str) -> Breakfast {
|
|
Breakfast {
|
|
toast: String::from(toast),
|
|
seasonal_fruit:String::from("Peaches"),
|
|
}
|
|
}
|
|
}
|
|
|
|
fn fix_incorrect_order(){
|
|
cook_order();
|
|
super::deliver_order();
|
|
}
|
|
fn cook_order(){}
|
|
}
|
|
|
|
|
|
pub fn eat_at_restaurant() {
|
|
let mut meal = back_of_house::Breakfast::summer("rye");
|
|
meal.toast = String::from("Wheat");
|
|
println!("I'd like {} toast please", meal.toast);
|
|
|
|
let _order1 = back_of_house::Appetizer::Soup;
|
|
let _order2 = back_of_house::Appetizer::Salad;
|
|
;
|
|
}
|