Commands

  1. new cargo new project creates a new directory and project called project. It has also initialized a new Git repository along with a .gitignore file. Git files won’t be generated if you run cargo new within an existing Git repository; you can override this behavior by using cargo new --vcs=git.

TOML

Cargo uses TOML (Tom’s Obvious, Minimal Language) format as configuration.

[package]
name = ""
version = ""
edition = ""
 
[dependencies]

The first line, [package], is a section heading that indicates that the following statements are configuring a package. As we add more information to this file, we’ll add other sections.

The next three lines set the configuration information Cargo needs to compile your program: the name, the version, and the edition of Rust to use.

The last line, [dependencies], is the start of a section for you to list any of your project’s dependencies. In Rust, packages of code are referred to as crates.