A Rust project template that works with cargo-generate!
Explore the docs »
View Demo
·
Report Bug
·
Request Feature
Table of Contents
This is a Rust project template designed to work seamlessly with cargo-generate. It provides a solid foundation for starting new Rust projects with best practices already configured.
Key features:
- Pre-configured Cargo.toml with optimized release profiles
- Basic project structure with error handling using thiserror
- Rust formatting and linting configurations (.rustfmt.toml, .clippy.toml)
- Ready-to-use GitHub Actions workflows
- MIT License included
This template helps you focus on building your project instead of setting up boilerplate code.
This template is configured for Rust projects and includes:
- cargo-generate - Template generation tool
- thiserror - Error handling
- Rust 2024 edition
This template is designed to work with cargo-generate, which allows you to quickly create a new Rust project from this template.
First, you need to install cargo-generate:
cargo install cargo-generateTo create a new project from this template, use the following command:
cargo generate --git https://github.com/emo-crab/rust-templateYou'll be prompted to provide:
- Project name: The name of your new project
- GitHub username: Your GitHub username or organization name
- Project description: A brief description of your project
Alternatively, you can clone this repository and use it as a starting point:
git clone https://github.com/emo-crab/rust-template.git
cd rust-template
# Make your changesAfter generating your project from this template, you can:
-
Build your project:
cargo build
-
Run tests:
cargo test -
Run your project (if you add a binary):
cargo run
-
Format your code:
cargo fmt
-
Run linting:
cargo clippy
This template includes optimized release profiles for smaller binary sizes and better performance. Check the Cargo.toml file for details.
- Add Changelog
- Add back to top links
- Add Additional Templates w/ Examples
- Add "components" document to easily copy & paste sections of the readme
- Multi-language Support
- Chinese
- Spanish
See the open issues for a full list of proposed features (and known issues).
Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.
If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature) - Commit your Changes (
git commit -m 'Add some AmazingFeature') - Push to the Branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Distributed under the MIT License. See LICENSE for more information.
Your Name - @your_twitter - email@example.com
Project Link: https://github.com/emo-crab/rust-template
Use this space to list resources you find helpful and would like to give credit to. I've included a few of my favorites to kick things off!