src/modules/exercise.md
In this exercise, you will reorganize a small GUI Library implementation. This
library defines a Widget trait and a few implementations of that trait, as
well as a main function.
It is typical to put each type or set of closely-related types into its own module, so each widget type should get its own module.
The Rust playground only supports one file, so you will need to make a Cargo project on your local filesystem:
cargo init gui-modules
cd gui-modules
cargo run
Edit the resulting src/main.rs to add mod statements, and add additional
files in the src directory.
Here's the single-module implementation of the GUI library:
# // Copyright 2023 Google LLC
# // SPDX-License-Identifier: Apache-2.0
#
{{#include exercise.rs:single-module}}
Encourage students to divide the code in a way that feels natural for them, and
get accustomed to the required mod, use, and pub declarations. Afterward,
discuss what organizations are most idiomatic.