You can use this template to start a new rust project.
- (install nix and open nix flake development shell)
- the git repo contains a
flake.nix
configuration - you can open a dev shell via
nix develop
- you can open vscode from inside the nix dev shell via
- option 1:
nix develop --command code .
- option 2:
./ctl.sh nix:vscode
- option 1:
- create your own repo by using this template
- rename your package
- in
Cargo.toml
- in
- rename
project
variable insrc/main.rs
for log level configuration
-
you can run the code via
cargo run
-
this template use a rust crate called clap for cli development
-
use cli arguments after two dashes
--
when running the program viacargo
# cli help cargo run -- -h # example run cargo run -- --name Julius --count 3
- set the environment variable
RUST_LOG
to configure log levels per module
RUST_LOG="warn,rust_project_template::example_module::example_submodule=debug" cargo run
- create a file called
.env
in the root dir of the repoRUST_LOG="warn,rust_project_template::example_module::example_submodule=debug"
- run you app with the following command
./ctl.sh cargo:run