From c9491c287437fbe68fb817923c002fca03c3e8d5 Mon Sep 17 00:00:00 2001 From: sgoudham Date: Fri, 14 Jan 2022 00:51:03 +0000 Subject: [PATCH] Separate into different files --- restaurant/src/front_of_house.rs | 1 + restaurant/src/front_of_house/hosting.rs | 3 +++ restaurant/src/lib.rs | 24 ++++++------------------ 3 files changed, 10 insertions(+), 18 deletions(-) create mode 100644 restaurant/src/front_of_house.rs create mode 100644 restaurant/src/front_of_house/hosting.rs diff --git a/restaurant/src/front_of_house.rs b/restaurant/src/front_of_house.rs new file mode 100644 index 0000000..922672c --- /dev/null +++ b/restaurant/src/front_of_house.rs @@ -0,0 +1 @@ +pub mod hosting; \ No newline at end of file diff --git a/restaurant/src/front_of_house/hosting.rs b/restaurant/src/front_of_house/hosting.rs new file mode 100644 index 0000000..1139f8b --- /dev/null +++ b/restaurant/src/front_of_house/hosting.rs @@ -0,0 +1,3 @@ +pub fn add_to_waitlist() { + println!("Added To Waitlist!"); +} \ No newline at end of file diff --git a/restaurant/src/lib.rs b/restaurant/src/lib.rs index dbe6d78..d2d5720 100644 --- a/restaurant/src/lib.rs +++ b/restaurant/src/lib.rs @@ -1,22 +1,6 @@ -mod front_of_house { - pub mod hosting { - fn add_to_waitlist() { - println!("hello") - } - - pub fn seat_at_table() { - add_to_waitlist(); - } - } - - mod serving { - fn take_order() {} +mod front_of_house; - fn serve_order() {} - - fn take_payment() {} - } -} +pub use crate::front_of_house::hosting; mod back_of_house { pub enum Appetizer { @@ -46,4 +30,8 @@ pub fn eat_at_restaurant() { let orderOne = back_of_house::Appetizer::Soup; let orderTwo = back_of_house::Appetizer::Salad; + + hosting::add_to_waitlist(); + hosting::add_to_waitlist(); + hosting::add_to_waitlist(); } \ No newline at end of file