Rust Project Setup
2023 Jan 17 Tue
David Wallace Croft
In recommended reading order
Visual Studio Code (VS Code)
You will want to install this before you install git
When it prompts you to select your editor, choose VS Code
If you previously installed Rust, you can update it:
Install the following VS Code extensions
Use cargo to make the project directory
cargo new project-name
Test your setup
Open VS Code
Add properties to the package section of your Cargo
manifest file Cargo.toml
name = "project-name"
version = "0.1.0"
authors = ["First Middle Last <firstname.lastname@example.org>"]
# Use the categories from https://crates.io/categories
categories = ["category-name"]
description = "project description"
edition = "2021"
homepage = "https://www.domain-name.com/"
keywords = ["keyword"]
# Remark this line out if your project is not open source
license = "MIT"
# Remark this line out when you publish to crates.io
publish = false
readme = "README.md"
# Remark this line out if your project is not in a code repository
repository = "https://github.com/github-username/project-name"
Make a README.md file in your project root directory
# Project Name
- Project description
- cd project-name/
- cargo run
- Initial release: YYYY-MM-DD
in your project root directory
array_width = 1
# blank_lines_lower_bound = 1
chain_width = 80
fn_args_layout = "Vertical"
# group_imports = "StdExternalCrate"
hard_tabs = false
# imports_layout = "HorizontalVertical"
match_block_trailing_comma = true
max_width = 80
merge_derives = true
newline_style = "Unix"
remove_nested_parens = true
reorder_imports = true
reorder_modules = true
single_line_if_else_max_width = 0
struct_lit_width = 0
struct_variant_width = 0
tab_spaces = 2
use_try_shorthand = true
# version = "Two"
# wrap_comments = true
If your project is open source, make a LICENSE.txt file
Copyright (c) [year] [copyright-holder-name]
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
Commit your code changes
git add .
git commit -m "Rust project setup"
Push to your remote code repository