end of chapter 7
This commit is contained in:
parent
dab55f5a6f
commit
730c82324e
68
chapter7/restaurant/Cargo.lock
generated
68
chapter7/restaurant/Cargo.lock
generated
@ -2,6 +2,74 @@
|
|||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "cfg-if"
|
||||||
|
version = "1.0.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "getrandom"
|
||||||
|
version = "0.2.9"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c85e1d9ab2eadba7e5040d4e09cbd6d072b76a557ad64e797c2cb9d4da21d7e4"
|
||||||
|
dependencies = [
|
||||||
|
"cfg-if",
|
||||||
|
"libc",
|
||||||
|
"wasi",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.144"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "ppv-lite86"
|
||||||
|
version = "0.2.17"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand"
|
||||||
|
version = "0.8.5"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404"
|
||||||
|
dependencies = [
|
||||||
|
"libc",
|
||||||
|
"rand_chacha",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_chacha"
|
||||||
|
version = "0.3.1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88"
|
||||||
|
dependencies = [
|
||||||
|
"ppv-lite86",
|
||||||
|
"rand_core",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "rand_core"
|
||||||
|
version = "0.6.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c"
|
||||||
|
dependencies = [
|
||||||
|
"getrandom",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "restaurant"
|
name = "restaurant"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"rand",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "wasi"
|
||||||
|
version = "0.11.0+wasi-snapshot-preview1"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423"
|
||||||
|
@ -6,3 +6,4 @@ edition = "2021"
|
|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
|
rand = "0.8.5"
|
||||||
|
4
chapter7/restaurant/src/front_of_house.rs
Normal file
4
chapter7/restaurant/src/front_of_house.rs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
pub mod hosting;
|
||||||
|
|
||||||
|
pub mod serving
|
||||||
|
|
2
chapter7/restaurant/src/front_of_house/hosting.rs
Normal file
2
chapter7/restaurant/src/front_of_house/hosting.rs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
pub fn add_to_waitlist() {}
|
||||||
|
pub fn seat_at_table() {}
|
3
chapter7/restaurant/src/front_of_house/serving.rs
Normal file
3
chapter7/restaurant/src/front_of_house/serving.rs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
pub fn take_order() {}
|
||||||
|
pub fn serve_order() {}
|
||||||
|
pub fn take_payent() {}
|
@ -1,14 +1,7 @@
|
|||||||
pub mod front_of_house {
|
mod front_of_house;
|
||||||
pub mod hosting {
|
|
||||||
pub fn add_to_waitlist() {}
|
pub use crate::front_of_house::hosting;
|
||||||
pub fn seat_at_table() {}
|
|
||||||
}
|
|
||||||
pub mod serving {
|
|
||||||
pub fn take_order() {}
|
|
||||||
pub fn serve_order() {}
|
|
||||||
pub fn take_payent() {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
fn deliver_order() {}
|
fn deliver_order() {}
|
||||||
|
|
||||||
mod back_of_house {
|
mod back_of_house {
|
||||||
@ -37,12 +30,9 @@ mod back_of_house {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
mod customer {
|
||||||
|
use crate::front_of_house::hosting;
|
||||||
pub fn eat_at_restaurant() {
|
pub fn eat_at_restaurant() {
|
||||||
let mut meal = back_of_house::Breakfast::summer("rye");
|
hosting::add_to_waitlist();
|
||||||
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;
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user