Creating a new Rust project is as easy as typing
cargo new <project_name>,
but often you need more than what
cargo new gives you.
This is when cargo generate comes into play:
cargo-generate is a developer tool to help you get up and running quickly with a new Rust project by leveraging a pre-existing git repository as a template.
Rust GitHub Template (this project)
is a template for
cargo generate that aims to be a starting point suitable for
the vast majority of rust projects that will be hosted on GitHub.
Stop copy pasting tons of markdown and yaml files each time you start a new rust project. Let’s write them only once, together!
You can see an example of this template here.
[0-9]+.[0-9]+.[0-9]+format (for example
cargo generate (version >= 6.0).
cargo install cargo-generate
create your project with this template.
cargo generate --git https://github.com/rust-github/template.git
cd into your project.
this is just a template, so edit your project according to your own needs by adding what’s necessary and removing what you don’t like.
create a new empty repository (do not initialize it
with a README, a
.gitignore or a license).
follow GitHub instruction to “push an existing repository from the command line”.
Set up your crates.io token in a
For more info about the crates.io tokens, see The Cargo Book.
When you are ready to publish the first version of your application, run:
git tag -a 0.1.0 git push --follow-tags
This tag should trigger the continuous deployment, that will:
The best way to support the project is to contribute to it by reporting problems, ideas or sending pull requests.
[![Rust GitHub Template](https://img.shields.io/badge/Rust%20GitHub-Template-blue)](https://rust-github.github.io/)
<a href="https://rust-github.github.io/"><img alt="Rust GitHub Template" src="https://img.shields.io/badge/Rust%20GitHub-Template-blue" /></a>
Thank you! 🙏