What is cargo in Rust Language?

Cargo is an official rust package management tool to create and compile and execute rust applications. It is similar to npm in Nodejs and dart pub in dart/Flutter.

With cargo, you can create the following things

dependencies are configured in the toml file download the dependencies from crates.io Compile packages upload dependencies into crates.io

Create an application with Cargo

A:\work\rust>cargo new firstapp
     Created binary (application) `firstapp` package

Here is folder structure of an application created with cargo



│   .gitignore
│   Cargo.lock
│   Cargo.toml
│
├───src
│       main.rs
│
└───target
    │   .rustc_info.json
    │   CACHEDIR.TAG
    │
    └───debug
        │   .cargo-lock
        │   firstapp.d
        │   firstapp.exe
        │   firstapp.pdb
        │
        ├───.fingerprint
        │   └───firstapp-e68389ed46d6bd29
        │           bin-firstapp
        │           bin-firstapp.json
        │           dep-bin-firstapp
        │           invoked.timestamp
        │
        ├───build
        ├───deps
        │       firstapp.d
        │       firstapp.exe
        │       firstapp.pdb
        │
        ├───examples
        └───incremental
            └───firstapp-o4oqw0ldn9i8
                │   s-g8p7jzqdgh-zkc3h7.lock
                │
                └───s-g8p7jzqdgh-zkc3h7-2exf863waqrj1
                        2tf2ot9x0ayv97jm.o
                        3dg6fjtpg4mc8d0e.o
                        3o1fkpoam27106fo.o
                        3wpxon66x8f2ttmx.o
                        47dn1uxiswgfa140.o
                        4q5joxozhhx0br3u.o
                        6igwucj9qi6qaxw.o
                        dep-graph.bin
                        query-cache.bin
                        uo6o7oqfq3u35j7.o
                        work-products.bin

A:\work\rust\firstapp>cargo build
   Compiling firstapp v0.1.0 (A:\work\rust\firstapp)
    Finished dev [unoptimized + debuginfo] target(s) in 1.02s
A:\work\rust\firstapp>cargo run
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `target\debug\firstapp.exe`
Hello, world!