TExcelTAD
Home › Rust › Rust Intro

Rust Introduction

Rust is a modern systems programming language focused on three goals: speed, memory safety and fearless concurrency. It gives you the low-level control of C and C++, but its compiler checks your code so that whole families of bugs — dangling pointers, data races, use-after-free — simply cannot compile.

What is Rust used for?

  • Command-line tools (for example ripgrep and bat)
  • Web servers and back-end services
  • Operating systems, embedded devices and firmware
  • WebAssembly modules that run in the browser
  • Game engines and performance-critical libraries

Why learn Rust?

Feature What it means for you
No garbage collector Predictable performance and small binaries
Ownership system Memory safety is checked at compile time
Great tooling cargo builds, tests, documents and publishes your code
Helpful compiler Error messages explain the problem and suggest a fix

Your first Rust program

Every Rust program starts running in a function called main. Press ▶ Run to compile and run it, then change the text and run it again.

rust · try it yourself
fn main() {
    println!("Hello, World!");
}
Hello, World!

println! prints a line of text. The ! means it is a macro, not a normal function — you will learn more about that in the Output chapter.

Tip: In every playground on ExcelTAD you can edit the code and press Ctrl+Enter to run it.

Printing more than one line

rust · try it yourself
fn main() {
    println!("Rust is fast.");
    println!("Rust is safe.");
    println!("Rust is fun!");
}
Rust is fast.
Rust is safe.
Rust is fun!

Test yourself

Which function does every Rust program start from?

  1. start()
  2. main()
  3. run()
  4. init()

What does the ! in println! tell you?

  1. The call is unsafe
  2. It is a macro
  3. It prints an error
  4. It returns a boolean