O'Reilly logo
live online training icon Live Online training

Fundamentals of Rust

Learn Rust and develop UNIX system utilities and network applications

Mihalis Tsoukalos

Rust is a modern, highly popular, general purpose open source programming language. Rust is not only fast and memory safe, it also supports concurrent programming and offers Cargo, which is the dependency and built-in management tool of Rust.

The purpose of this is course is to introduce you to the Rust programming language using a variety of code examples. You will learn how to write and execute Rust programs and use Cargo. You'll also understand how to use the data types of Rust and create your own structures and Rust packages. The course guides you in writing concurrent applications in Rust, generating random numbers, and organizing your Rust code into packages, along with creating TCP/IP servers and clients and using WebAssembly with Rust.

What you'll learn-and how you can apply it

  • How to work with Rust data types and composite types
  • How to utilize Cargo
  • Develop basic UNIX command-line utilities
  • Develop concurrent applications
  • Use WebAssembly with Rust
  • Develop a TCP server as well as a TCPclient in Rust

This training course is for you because...

The course is aimed at UNIX developers, administrators and web developers with a background in programming languages such as Python, C, C++, Perl, Ruby, and PHP who want to start developing system tools, web and TCP/IP applications in Rust. This course will also be beneficial for those interested in developing command-line utilities and applications that work over networks in Rust.

Prerequisites

  • A working UNIX system like Linux and macOS – any UNIX system with a recent Rust installation will do.
  • Basic knowledge of a UNIX shell – the bash shell will be used in this Live Course but you can use any UNIX shell of your choice.

Materials, downloads, or Supplemental Content needed in advance

  • A recent Rust installation
  • A text editor such as vim, Emacs, or TextMate.

About your instructor

  • Mihalis Tsoukalos is a UNIX administrator, programmer, DBA, and mathematician, who enjoys writing technical books and articles and learning new things. He has written more than 250 technical articles for many magazines including Sys Admin, MacTech, Linux User and Developer, USENIX; login:, Linux Format, and Linux Journal. His research interests include databases, operating systems, Statistics, and machine learning.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

DAY 1

Section 1: A gentle introduction to Rust (30 minutes)

  • Understanding Rust
  • Installing Rust on macOS
  • Installing Rust on Linux
  • Finding out your version of Rust
  • The advantages of Rust
  • The disadvantages of Rust
  • What you need to know
  • About the UNIX operating system
  • A simple Rust program (Hello World!)
  • Explaining the Rust program
  • An introduction to Ownership and Borrowing

Section 2: An introduction to Rust data types, Functions, and Packages (50 minutes)

  • Rust data types
  • Rust Arrays
  • Loops in Rust
  • Functions in Rust
  • Rust packages
  • Getting user input and printing output
  • The Rust package manager: Cargo

BREAK 1 (10 minutes)

Lab 1: Compiling and Executing Rust code + Rust data types (30 minutes)

  • Executing the Rust version of the Hello World program
  • Working with Rust data types and data structures

Lab 2: Using Cargo + Creating a Rust package (30 minutes)

  • Using Cargo
  • Developing a Rust package

BREAK 2 (10 minutes)

Section 3: Introduction to Rust Composite Types (50 minutes)

  • Ownership and Borrowing revisited
  • Structures
  • Collections
  • Text

Lab 3: Working with Text and Generating Random numbers (30 minutes)

  • About random number generation
  • Developing the program
  • Working with text

DAY 2

Section 4: Concurrency in Rust (50 minutes)

  • About concurrency
  • Code examples

Lab 4: Concurrency in Rust (30 minutes)

  • Executing your first concurrent Rust program
  • An exercise

BREAK 1 (10 minutes)

Section 5: A simple TCP server and Client (50 minutes)

  • About TCP/IP
  • About TCP and IP

Lab 5: Developing the TCP server and the TCP client (30 minutes)

  • Developing a TCP server that returns random numbers
  • Creating a TCP client
  • Developing a UDP client and server

BREAK 2 (10 minutes)

Section 6: Rust and WebAssembly (30 minutes)

  • Understanding WebAssembly
  • Why Rust and WebAssembly
  • An example

Lab 6: WebAssembly (30 minutes)

  • Running the WebAssembly example