Split up restaurant
package
This commit is contained in:
parent
150e2faf44
commit
0bae9c88d5
5 changed files with 33 additions and 37 deletions
20
restaurant/src/back_of_house.rs
Normal file
20
restaurant/src/back_of_house.rs
Normal 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() {}
|
3
restaurant/src/front_of_house.rs
Normal file
3
restaurant/src/front_of_house.rs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
pub mod hosting;
|
||||||
|
|
||||||
|
mod serving;
|
3
restaurant/src/front_of_house/hosting.rs
Normal file
3
restaurant/src/front_of_house/hosting.rs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
pub fn add_to_waitlist() {}
|
||||||
|
|
||||||
|
fn seat_at_table() {}
|
5
restaurant/src/front_of_house/serving.rs
Normal file
5
restaurant/src/front_of_house/serving.rs
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
fn take_order() {}
|
||||||
|
|
||||||
|
fn serve_order() {}
|
||||||
|
|
||||||
|
fn take_payment() {}
|
|
@ -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
|
||||||
|
|
Loading…
Reference in a new issue