Misc Rust templates for use with `cargo-generate`
Here are a few templates for use when creating Rust applications.
The templates take full advantage of cargo-generate
subtemplates, thust the repo contains both
project templates and several smaller templates that are used to add functionality to an already
existing project.
Project templates have optional support for generating IDE scaffolding (currently only Vscode, contributions for others are welcome).
Simple setup for a base workspace, ready to put your projects in.
Binary with a command line (clap
) interface.
Template is setup to use:
clap
tokio
(Optional)tracing
console-subscriber
, by using tokio
and enabling the feature tokio-console
(Optional)tokio-test
supportLibrary crate.
The library will be setup for use with:
no-std
, by disabling the default feature std
tracing
tokio-test
supporttokio-test
supportSeveral templates are included that function as snippets that integrate into in existing project.
Just try and expand the template repository and let cargo-generate
guide you.
If the template is used on a regular basis, cargo-generate allows to setup favorite templates and default variables.
To do this, open or create the file $CARGO_HOME/cargo-generate.toml
, insert this:
[values]
gh_username = "your username on github.com"
ide = "none|vscode"
[favorites.rust]
git = "https://github.com/taurr/rust-template-rs"
subfolder = "Projects"
[favorites.snippet]
git = "https://github.com/taurr/rust-template-rs"
subfolder = "Snippets"
After this, the template can be expanded using a simple:
cargo generate rust
or:
cargo generate snippet