O'Reilly logo

Mastering Rust by Vesa Kaihlavirta

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Founding a project - cargo init

The cargo init command creates a new project structure: a Cargo.toml file with the essential metadata prefilled and a skeleton src/main.rs (for binary projects) or src/lib.rs (for library projects):

By default, cargo init creates a new library; the --bin parameter has to be used when creating a project that we want to run. Try it out and take a look at the directory structure it creates:

Cargo created for you a Git repository and the files, Cargo.toml and src/main.rs. Let's take a look at Cargo.toml; this is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required