Difficulty: beginner
Estimated Time: As long as you need

Rust logo

Objective

The objective of this scenario is to provide prospective Rust developers with a playground in which to experiment with Rust programming.

You'll start by installing Rust within the Katacoda interactive learning environment. Then, you'll write a simple Hellow World program in Rust.

You'll have a completely functional Rust programming environment in which to create great Rust programs.

Also, there's a version of Visual Studio Code built right into Katacoda. You can use it to create your Rust source code.

Click the START SCENARIO button to continue.

v.06.25.2020

The Rust icon is a graphic link from rust-lang.org

Rust logo

Is Rust cool or what?

To learn more about Rust, go to project page, here

Rust Playground

The Rust Playground

Rust logo

Objective

This playground is intended for developers who want to learn to work with Rust.

A version of Visual Studio Code is embedded in this Katacoda interactive learning environment. Just click the IDE tab at the top of the terminal pane to the right.

Steps

Step 1: Run the following curl command to install Rust.

IMPORTANT: During the installation process you will be asked to select an option. Select option 1.

curl https://sh.rustup.rs -sSf | sh

You should see output similar to the following:

Rust is installed now. Great!

Step 2: Set the environment variables required by Rust

source $HOME/.cargo/env

Step 3: Create a basic Rust program. Click the following command to create the empty Rust file

mkdir rust && cd rust

touch hello.rs

Step 4: Open the vi editor to add Rust code

vi hello.rs

Strike the i key on your keyboard to go into edit mode

i

Step 4: Enter the following code in the file, hello.rs within the vi editor

fn main(){
   println!("Katacoda says \"Welcome to your most excellent Rust coding session!!\"");
}

Step 5: Exit vi

Strike the Esc key on your keyboard to exit edit mode in vi.

Strike the keys :wq to write the Rust file and exit vi.

Step 6: Compile the code

rustc ./hello.rs

Step 7: Run the compiled executable

./hello

Next Steps

Sit down, hit the keys and code!