add practice projects

This commit is contained in:
sunface
2022-03-14 21:14:52 +08:00
parent df2e2fe02c
commit 80cc58aebe
10 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,7 @@
use crate::front_of_house;
pub fn fix_incorrect_order() {
cook_order();
front_of_house::serving::serve_order();
}
pub fn cook_order() {}

View File

@ -0,0 +1,6 @@
pub fn add_to_waitlist() {}
pub fn seat_at_table() -> String {
String::from("sit down please")
}

View File

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

View File

@ -0,0 +1,9 @@
pub fn take_order() {}
pub fn serve_order() {}
pub fn take_payment() {}
// Maybe you don't want the guest hearing the your complaining about them
// So just make it private
fn complain() {}

View File

@ -0,0 +1,12 @@
mod front_of_house;
mod back_of_house;
pub use crate::front_of_house::hosting;
pub fn eat_at_restaurant() -> String {
front_of_house::hosting::add_to_waitlist();
back_of_house::cook_order();
String::from("yummy yummy!")
}

View File

@ -0,0 +1,4 @@
fn main() {
assert_eq!(hello_package::hosting::seat_at_table(), "sit down please");
assert_eq!(hello_package::eat_at_restaurant(),"yummy yummy!");
}