This is a simple and educational reusable Rust library.
It demonstrates how to:
- Organize code with modules and files
- Control visibility using
pub - Build reusable components for a real-world-like domain
- Clear modular structure:
front_of_housevsback_of_house - Controlled visibility using pub and private fields
- Public interface via
eat_at_restaurant()or individual module APIs - Separate file organization, for scalability.
restaurant/ βββ Cargo.toml βββ src/ β βββ lib.rs # Library root β βββ front_of_house.rs # Handles customer interactions β βββ back_of_house.rs # Kitchen logic β βββ bin/ β βββ main.rs # Binary example that uses the library
git clone https://github.com/jolah1/restaurant.git
cd restaurant
cargo run --bin mainuse restaurant::eat_at_restaurant;
fn main() {
eat_at_restaurant();
}
Added to waitlist.
Added to waitlist.
I'd like Wheat toast please-
Building Rust libraries with clear public APIs
-
Managing code with modular file structure
-
Using privacy rules to protect internal logic
-
Preparing codebases for scalability and reusability