Go to file Use this template
2024-02-10 00:00:06 +01:00
Projects/01_HelloWorld run a compiled executable called ./main 2024-02-09 22:57:04 +00:00
.gitignore set readme as org file 2024-02-09 21:39:24 +00:00
LICENSE Initial commit 2024-02-09 22:22:59 +01:00
README.org run a compiled executable called ./main 2024-02-09 22:57:04 +00:00

RustBook

Getting Started

Chapter 01: Installation

Recommendation is to use rustup using the command:

  curl --proto '=https' --tlsv1.2 https://sh.rustup.rs -sSf | sh

To confirm it's installed:

  rustup --version
rustup 1.26.0 (5af9b9484 2023-04-05)

Update

To update rustup and please do regularly

  rustup update

  stable-x86_64-unknown-linux-gnu unchanged - rustc 1.76.0 (07dca489a 2024-02-04)

Documentation

rustup comes with documentation, just type

  rustup doc

and the browser will open a page with links toward lots of docs.

Chapter 02: Hello, World!

Basically done in 3 steps:

  • Edit the rs file
  • Compile using rustc
  • Call the executable

Work folder is Projects/01_HelloWorld, where we create the file main.rs

  fn main() {
      println!("Hello, World!");
  }

To execute this program:

  cd Projects/01_HelloWorld/
  rustc main.rs
  ./main
Hello, World!

The program wordes, I'm now done.

Note

All rust program starts by calling the function main. Functions with ! appended to their name, like println!, are macros.