A template for library Rust projects.
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
Bauke 833d1d7ea7
Update Cargo.toml and replace rust-lib-template in it automatically.
11 个月前
source Move to self-hosted Gitea. 1年前
.gitignore Initial commit. 1年前
Cargo.toml Update Cargo.toml and replace rust-lib-template in it automatically. 11 个月前
LICENSE Move to self-hosted Gitea. 1年前
README.md Update Cargo.toml and replace rust-lib-template in it automatically. 11 个月前
rustfmt.toml Initial commit. 1年前

README.md

Rust Library Template

A template for library Rust projects.

“Features”

AKA personal preferences.

  • source/ instead of src/ directory.
  • Rustfmt configuration with:
    • 80 character max line length.
    • 2 space indentation.
  • Cargo lockfile gitignored as per The Cargo Book.

Usage

The command below will:

  • Clone the project to new-project.
  • Change directory into it.
  • Remove the existing git history.
  • Initialize git to start anew.
  • Replace rust-lib-template in Cargo.toml with new-project.
git clone "https://git.holllo.cc/Bauke/rust-lib-template.git" new-project &&
cd $_ &&
rm -rf .git/ &&
git init &&
sed -i "s|rust-lib-template|$1|" "Cargo.toml"

Reusable Function

Add this to your .bashrc, .zshrc (or similar) configuration so you don’t have to copy-paste that whole command every time.

new-rust-lib () {
  git clone "https://git.holllo.cc/Bauke/rust-lib-template.git" "$1" &&
  cd "$1" &&
  rm -rf .git/ &&
  git init &&
  sed -i "s|rust-lib-template|$1|" "Cargo.toml"
}

Then use it as new-rust-lib new-project.

License

Open-sourced with the Unlicense.