Skip to content

inc4/rust-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rust-template

Checks

This template can be used when creating a new Rust repository. Choose it when you create a repository in the GitHub web interface, or use --template flag with gh repo create.

Getting started

  • Review all files if you haven't done so before.
  • Remove examples and rewrite this README.
  • Change the name rust-template everywhere: Cargo.toml, Dockerfile, workflow files in .github/workflows/.

Layout

  • src/main.rs — the binary entry point. Keep it thin: argument parsing, wiring, startup. Most logic belongs in the library.
  • src/lib.rs — the library root. Add modules here. Anything reusable or testable in isolation goes into the library, not the binary.
  • Unit tests are the primary form of testing. They live alongside the code they cover, in a #[cfg(test)] mod tests block at the bottom of each source file.
  • tests/ — integration tests. Optional: not every project needs them.

Build and run

cargo run
curl localhost:8080/hello

Check, lint, test

cargo fmt --all
cargo clippy --tests
cargo test

Docker

docker buildx build -t rust-template --load .
docker run --rm -p 8080:8080 rust-template

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors