Split up restaurant package

This commit is contained in:
Manuel Thalmann 2025-01-19 18:18:50 +01:00
parent 150e2faf44
commit 0bae9c88d5
5 changed files with 33 additions and 37 deletions

View file

@ -0,0 +1,20 @@
pub struct Breakfast {
pub toast: String,
seasonal_fruit: String,
}
impl Breakfast {
pub fn summer(toast: &str) -> Breakfast {
Breakfast {
toast: String::from(toast),
seasonal_fruit: String::from("peaches"),
}
}
}
fn fix_incorrect_order() {
cook_order();
crate::deliver_order();
}
fn cook_order() {}

View file

@ -0,0 +1,3 @@
pub mod hosting;
mod serving;

View file

@ -0,0 +1,3 @@
pub fn add_to_waitlist() {}
fn seat_at_table() {}

View file

@ -0,0 +1,5 @@
fn take_order() {}
fn serve_order() {}
fn take_payment() {}

View file

@ -1,43 +1,8 @@
fn deliver_order() {} fn deliver_order() {}
mod front_of_house { mod front_of_house;
pub mod hosting {
pub fn add_to_waitlist() {}
fn seat_at_table() {} mod back_of_house;
}
mod serving {
fn take_order() {}
fn serve_order() {}
fn take_payment() {}
}
}
mod back_of_house {
pub struct Breakfast {
pub toast: String,
seasonal_fruit: String,
}
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() { pub fn eat_at_restaurant() {
// Order a breakfast in the summer with Rye toast // Order a breakfast in the summer with Rye toast