A template for library Rust projects.
No puede seleccionar más de 25 temas Los temas deben comenzar con una letra o número, pueden incluir guiones ('-') y pueden tener hasta 35 caracteres de largo.
Bauke 833d1d7ea7
Update Cargo.toml and replace rust-lib-template in it automatically.
hace 11 meses
source Move to self-hosted Gitea. hace 1 año
.gitignore Initial commit. hace 1 año
Cargo.toml Update Cargo.toml and replace rust-lib-template in it automatically. hace 11 meses
LICENSE Move to self-hosted Gitea. hace 1 año
README.md Update Cargo.toml and replace rust-lib-template in it automatically. hace 11 meses
rustfmt.toml Initial commit. hace 1 año

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.