Creation
In the directory of your choice (e.g. your Desktop),
create your Rust project:
{
# Edit these variables:
projDest="$HOME/Desktop"
projName="hello-world"
# Create our project
cd "${projDest}"
cargo new "${projName}" --bin
# Bootstrap our project
mkdir -pv "${projName}/.vscode"
cd $_
jo -p recommendations=$(jo -a "matklad.rust-analyzer" "formulahendry.code-runner") > extensions.json
jo -p "code-runner.executorMap"="$(jo "rust"="cargo run # \$fileName")" > settings.json
cd ..
# Clean-up
unset projDest projName
}
Which creates a directory with the following structure:
$HOME/Desktop/hello-world
├── .git
│ ├── HEAD
│ ├── config
│ ├── description
│ ├── hooks
│ │ └── README.sample
│ ├── info
│ │ └── exclude
│ ├── objects
│ │ ├── info
│ │ └── pack
│ └── refs
│ ├── heads
│ └── tags
├── .gitignore
├── .vscode
│ ├── extensions.json
│ └── settings.json
├── Cargo.toml
└── src
└── main.rs
Table of Contents