Rust Package Manager — Cargo

All the dependencies required by the Rust language can be managed by cargo which also acts as the build tool. If any dependency is missing from the project, cargo will automatically download the package and build the library for the project.

Same as git, to create an empty project that can be managed by cargo, one only needs to enter the following command:

$ cargo new "some_project" # or cargo new from the current directory.
$ cd ./some_project

In addition, a typical cargo-created project will contain the following files and directories:

.
├── Cargo.lock
├── Cargo.toml
├── src
└── target

You could build the project by

$ cargo build
cargo build
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s

You could run the project by

$ cargo run

cargo run        
   Compiling ch1_hello_rust v0.1.0 (/home/hiroki/rust-learning/ch1_hello_rust)
    Finished dev [unoptimized + debuginfo] target(s) in 0.56s
     Running `target/debug/ch1_hello_rust` # This is where the targetl locates.
Hello, world!