Skip to content

A template for generating generic Rust engineering projects using cargo-generate

License

Notifications You must be signed in to change notification settings

sicheng1806/sicheng-rust-template

Repository files navigation

Sicheng Rust Project Template

A template for generating generic Rust engineering projects using the cargo-generate.

Features

  • Configures GitHub Actions.
  • Uses cargo-clippy as the linter.
  • Uses cargo-fmt as the code formatting tool.
  • Uses cargo test for test.
  • Uses cargo-doc as the documentation generation tool.
  • Uses cargo-make as the automation tool.
  • Uses typos as the source code spell checker tool.
  • Uses codecov as the code coverage and quality tool.
  • Uses pre-commit to configure automated review scripts before git commit.

How to Use

  1. Install cargo-generate.
  2. Use the template:
cargo generate sicheng1806/sicheng-rust-template template

Project Structure

your-project/
├── Cargo.toml
├── develop.md
├── LICENSE
├── Makefile.toml
├── src
│   └── main.rs
└── _typos.toml

Project Develop Tools

This project requires the following tools to be installed:

  • git Git is a free and open source distributed version control system designed to handle everything from small to very large projects with speed and efficiency.
  • rust with cargo A language empowering everyone to build reliable and efficient software.
  • pre-commit A framework for managing and maintaining multi-language pre-commit hooks.

In addition to that, you also need to use cargo install to install some auxiliary tools:

  • cargo-make Rust task runner and build tool.
  • typos Finds and corrects spelling mistakes among source code.
  • Tarpaulin A code coverage reporting tool for the Cargo build system.

Initial Project

  • git init to initial a git repository.
  • pre-commit install to add git hooks.

Format code style

  • cargo check check the code.
  • cargo clippy run the linter.
  • cargo fmt run the formatter.

or do it by cargo-make: cargo make lint

Check spelling mistakes

  • typos to find spelling mistakes.
  • typos -w to fix spelling mistakes.

Test

  • cargo test to run the test.

or do it by cargo-make: cargo make test

Build document

  • cargo doc to build the document.

or do it by cargo-make: cargo make docs

Git tag

Modify package version value, then commit.

Add tag

git tag -a v0.1.0

Build

Build this tag distribution package.

cargo build

or do it by cargo make: cargo make build

About

A template for generating generic Rust engineering projects using cargo-generate

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published