Systems programming language that runs blazingly fast, prevents segfaults, and guarantees thread safety.
Cargo is Rust’s package manager. You can use it to download your project’s dependencies and to compile your project. You can start a new project using Cargo by typing:
$ cargo new my_project
This will create a new directory with manifest (
Cargo.toml), a source code directory
src) and a “Hello, World!” program in
$ cd my_project/ $ tree . . ├── Cargo.toml └── src └── main.rs 1 directory, 2 files
The manifest is written in TOML language and looks like this:
[package] name = "my_project" version = "0.1.0" authors = ["Your Name <email@example.com>"] [dependencies]
To run your new project, type:
$ cargo run Compiling my_project v0.1.0 (file:///home/fedora/rust/my_project) Running `target/debug/my_project` Hello, world!
Rust calls its compilation unit (either library or executable) a crate. Your project
is such a crate and it can also depend on other crates specified in
default repository to look for dependencies is crates.io but you
can also specify dependencies on a git repository.
Note: Cargo currently supports only source dependencies.