1. Getting Started

Getting Started

Development Setup

Rust

If you haven’t installed Rust (opens in a new tab) yet, follow the official instructions (opens in a new tab) to install.

Visual Studio Code

We recommend Visual Studio Code (opens in a new tab) as the code editor with the following extensions:

You can see how we configure the editor for Rust here (opens in a new tab). And for C++ here (opens in a new tab) if you are interested.

Initializing the Project

Cargo (opens in a new tab) is Rust’s build tool and package manager. To initialize a project, run below in the terminal:

cargo new ray-tracing

It will scaffold the project like this:

.
└── ray-tracing
    ├── Cargo.toml
    └── src
        └── main.rs

The Cargo.toml file is where we define our dependencies. The src folder is where we put our source files. The main.rs file is a “hello world” program Cargo generated for us.

Hello World

Change into the ray-tracing directory and run cargo run:

cd ray-tracing
cargo run

Cargo will build and run the project. You’ll see the greeting below in the terminal:

Hello, world!

And you are ready to go!