Rust/C2/Printing-Hello-World-using-Cargo/English
Title of the script: Printing Hello, World using Cargo
Author: Jayesh Katta Ramalingaiah
Domain Reviewer:
Novice Reviewer:
Keywords: Rust, cargo, package manager, function, rs
|
|
Slide: Title | Welcome to the spoken tutorial on Printing Hello World using Cargo. |
Slide:
Learning Objectives |
In this tutorial we will learn:
|
Slide: System Specifications | This tutorial is recorded using:
However you may use any other editor of your choice. |
Slide : Pre-requisites |
|
Slide: Why Cargo? |
|
Slide: What does Cargo do? |
|
Slide: Cargo Commands | Let’s begin understanding the commands first.
|
Press Ctrl+Alt+T keys | Open the terminal by pressing Ctrl, Alt and T keys simultaneously on the keyboard.
|
Only Narration | Here onwards, please remember to press the Enter key after typing each command. |
[Terminal] Type:
[Enter] |
Using cd command go to the Rust practice folder which we created earlier. |
[Terminal] Type:
|
Now let us create a Cargo project named sample_hello_word
|
[Terminal] Highlight:
|
A binary cargo application has been created.
|
Open Visual Studio Code editor. | You may use any editor of your choice.
|
[Editor]
Welcome Page -> Open Folder -> sample_hello_world |
Open the created project by clicking on the Open folder link in the Welcome page.
|
[Editor]
Click on SAMPLE_HELLO_WORLD |
On the EXPLORER section, expand the project folder “SAMPLE_HELLO_WORLD” by clicking on it. |
[Editor]
For respective names - show cursor in the left side pane |
We see the src folder and a Cargo.toml file created inside the project folder. |
[Editor] Click on src
|
Click on the src folder to expand it.
|
[Editor] Click on main.rs | Open the file main.rs by clicking on it. |
[Editor - main.rs]
Highlight the code |
We can see the hello world program written inside.
|
[Editor] Click on Cargo.toml | Open the file Cargo.toml from the project folder by clicking on it. |
[Editor - Cargo.toml]
Highlight the code |
We see two sections namely package and dependencies.
|
[Editor - Cargo.toml]
Highlight the package section |
This is where we can write all the project related information like name, version, authors, edition. |
[Editor - Cargo.toml]
Highlight the dependencies section |
We can even mention dependencies which the project depends upon. |
Switch to terminal | Switch back to the terminal. |
[Terminal] Type:
[Enter] |
So the Cargo project is created now.
|
[Terminal] Type:
|
Now type the command to build the Cargo project. |
[Terminal] Highlight:
|
When successfully compiled, we see a finished message. |
Only narration | If we encounter any error, it means we have not installed Cargo properly.
|
[Terminal] Type:
|
As the project is compiled successfully, it’s time to run the project.
|
[Terminal] Highlight:
|
Now we see Hello world! printed in the terminal. |
Only narration | With this we have come to the end of this tutorial.
|
Slide: Summary | In this tutorial, we have learnt how to create, compile and execute a Cargo project. |
Slide: Assignment | As an assignment,
|
Slide: About Spoken Tutorial Project |
|
Slide: Spoken tutorial workshops |
|
Slide: Forum questions | Pls post your timed questions in this forum |
Slide: Acknowledgement | Spoken Tutorial Project is funded by Ministry of Education, Government of India |
Slide: Thanks | This is Jayesh signing off. Thank you for joining |