Rust Programming
Rust Programming
Overview
Rust is a modern programming language with a unique set of
features, including memory safety, scalability, powerful
concurrency model, and zero-cost abstraction.
The combination of features, such ownership, lifetimes, and
trustworthy concurrency, included within Rust create strong
binaries that are reliable, robust, and highly performant.
Rust is a combination of various programming paradigms:
expression-oriented, pattern-oriented, and functional
programming models. This creates a development environment
that reenforces safe coding practices.
This course conveys the fundamentals of Rust including a
discussion of the features that make the language unique.
Graduate class with the ability to develop professional native
applications.
Finally, the class concludes with an introduction of threads.
Prerequisite / Audience
The audience for this course is software engineers and developers.
Students should have six months of general programming experience.
Course outline
Introduction
Learn the general syntax of Rust. At the end of the first section, students
will have established a foundation in Rust. This includes learning the core
Rust tools, crate paradigm, and basic language syntax.
Course Introduction
Installing Rust
Hello World - Rust
Basic error handling
Transfer of control and methods
Cargo Package Manager
Rust CLI
Transfer of control
Learn the standard transfer of control statements: if, for, while, and loop
statements. The match statement is presented with an introduction to
pattern matching.
If statement
While statement
For statement
Match statement
Short-circuiting
Complex types
Learn about the various sequences and complex types available in Rust.
This section begins with a discussion of arrays and vectors, which is a
dynamic sequence. This includes slices and partial sequences. Rust has a
variety of complex types.
Students will also learn how to use and implement with the Option <T> and
Result<T,E> types.
Structs
Enumeration
Option<t> If let while let
Arrays
Vectors
Slices
Strings
Tuples
HashMap
Pattern Matching
Generics
Traits
Learn how to define and implement traits. Traits are similar to an interface
in other languages. This includes creating extensible solutions using
polymorphism with dynamic dispatch. Benefits of traits, such as abstraction,
are also reviewed.
Define traits
Implementation
Abstraction
Dynamic Dispatch
Polymorphism
Important traits
Concurrency
Learn the basics of concurrent programming. This includes how to create
threads using independent functions and closures. Channels, the central
artifact of concurrent programming in Rust, is also introduced.
Starting a thread
Thread handles
Closures
Channels
Setup Instructions
Here are the setup instructions for the Rust programming class. The
instructor will use a combination of Visual Studio code for the Rust IDE and
the Rust CLI during class. Students can choose any Rust IDE, and are not
required to use Visual Studio code.
Rust language
For participating in class and class examples, install the Rust Programming
Language.
https://www.rust-lang.org/tools/install
After installing Rust, run these commands from a CLI (command line
interface).
Rustc --version
Cargo –version
If not successful, confirm that these tools are included in the path
environment variable.
Here are websites that provide additional assistance when installing Rust
on Linux, MacOS, or Windows.
Linux
https://tek.io/2DDO1Gd
https://bit.ly/3lTTUAx
MacOS / Linux
https://bit.ly/3lTTUAx
MacOS
https://bit.ly/2GE1DT8
Windows
https://bit.ly/3jUaBd3
Rust Playground
The Rust Playground is an online sandbox for using the Rust Programming
Language.
You can practice with the stable, beta, or nightly builds. In addition, you
can run both debug and release (optimized) builds.
https://play.rust-lang.org/
From the left panel, install the Rust for Visual Studio Code extension.
If extensions are not visible, select Extensions from the View menu.
You can also select the Extension icon from the vertical toolbar.
After installing, make sure the extension is activated, not disabled.
You are ready to begin developing code using the Rust Language!