Create a Rust package with the Cargo package manager

Pascal Precht
InstructorPascal Precht
Share this video with your friends

Social Share Links

Send Tweet
Published 4 years ago
Updated 3 years ago

In this lesson we’ll create a new Rust project using the cargo new command and take a look at some of the generated files.

Instructor: [00:00] The most convenient way to create a new Rust project is by using the Cargo package manager and its new commands. The new command takes the name of a project. Once we execute it, we'll see that it has generated a bunch of files including a Git repository, a src directory and a Cargo.toml file.

[00:28] The src directory only includes a main.rs file. If we take a look at its contents, we'll see it has a simple main() function that outputs "Hello, world!"

[00:42] The Cargo file is a package file that specifies the name of the project, its version, the author's name and its email address and the edition or version of the Rust programming language. Additionally, we can specify other configuration values such as dependencies or dev-dependencies.

Musicq Kui
Musicq Kui
~ 4 years ago

Wow, what that bat command is? More beautiful than cat

Pascal Precht
Pascal Prechtinstructor
~ 4 years ago

Hi!

bat is kinda like cat on steroids :) And it's written in Rust! https://github.com/sharkdp/bat

J. Matthew
J. Matthew
~ 4 years ago

bat is kinda like cat on steroids :) And it's written in Rust! https://github.com/sharkdp/bat

What about tree? Same deal?

Pascal Precht
Pascal Prechtinstructor
~ 4 years ago

Hey Matthew,

tree is another command that is available for different platforms. If you're on Mac you can install it via brew install tree (assuming you have homebrew installed).

Markdown supported.
Become a member to join the discussionEnroll Today