This week I’ve published a Rust template for demonstrating project module usage. Check the documentation for detailed getting started and usage instructions, the source code is available on GitHub. What follows is the TLDR for installation and usage…

Install Dependencies

cargo install cargo-generate

Initialize a Project from Repository

cargo generate --name 'your-application-name'\
               --git https://github.com/rust-utilities/template-project-modules.git

Or configure as a named template…

$CARGO_HOME/cargo-generate

[favorite.project-modules]
description = "Template for application scoped modules"
git = "https://github.com/rust-utilities/template-project-modules.git"
branch = "main"

… and initialize a project via favorite name…

cargo generate project-modules your-application-name

Build and Customize

cd your-application-name

cargo run

vim src/main.rs

There are examples within the source code of how to use modules within various scopes, as well as from directory and file level modules.