Rust Programming for Developers
Course Description
Aimed at C++ developers, this five-day Rust programming course dives deep into Rust's unique features, such as ownership and borrowing, pattern matching, and its powerful concurrency model. Led by an expert instructor, the course blends engaging content with practical labs to ensure you gain both theoretical knowledge and applied experience. You'll explore topics ranging from Rust's syntax, modules, and traits to advanced concepts like unsafe Rust, macros, and FFI integration, equipping you with the skills needed to build high-performance, safe, and scalable software.
5 Days
€2250.00
Objectives
Participants will learn how to:Understand Rust's Philosophy and Setup: Learn the principles behind Rust's design, install and configure the Rust environment, and navigate tools like Cargo and Rust Playground.
Master Rust Syntax and Semantics: Write efficient code using Rust's unique syntax for control flow, functions, and modules.
Implement Effective Memory Management: Master ownership, borrowing, and lifetimes to ensure memory safety and efficiency in your applications.
Harness Rust's Concurrency Model: Build concurrent applications with Rust's tools, including threads, Mutex, RwLock, and async/await for multitasking.
Utilize Rust's Ecosystem and Tools: Leverage Cargo for dependency management and explore popular crates to enhance your projects.
Apply Advanced Rust Features: Develop complex solutions using traits, generics, macros, and unsafe Rust for optimized performance and flexibility.
Build and Document Applications: Write robust tests using Rust's testing framework, and create clear, professional documentation with Rustdoc.
Pre-requisites
Basic Programming Knowledge: Familiarity with core programming concepts such as variables, loops, conditionals, and functions, gained from experience with any programming language.Basic Systems Knowledge: Understanding of memory management principles and general software development practices.
Who should attend
This course is designed for experienced software developers, system programmers, and engineers eager to adopt Rust for performance-critical and concurrent applications. Whether you're transitioning to systems programming or enhancing your current skill set, this training is ideal for those aiming to leverage Rust for its unique combination of performance, safety, and concurrency.Getting Started with Rust
What is Rust?Philosophy and Goals
History and Motivation
Rust Community and Ecosystem
Exploring the Rust Playground
Rust Editors & AI Tools
VSCode with ExtensionsRust Rover
Debug Rust in VSCode
GitHub Copilot & ChatGPT
Hello World
Creating a New Rust ProjectWriting the Main Function
Printing to the Console
Adding Comments to Code
Cargo
What is Cargo?Run Command
Build Command
Build Release Command
Install Third-Party Crates
Scalar Types and Data
Rust TypesDefining Constants in Rust
Using Immutable Variables
Utilizing Mutable Variables
Code Logic
If & If-LetMatch
Loop with Break & Continue
While & While-Let Loop
For-In Loop
Control-Flow as Expressions
Functions
Defining and Calling FunctionsSpecifying Parameter and Return Types
Creating and Using Closure Functions
Modules
Importing Modules from the Standard LibraryImporting Modules from Third-Party Crates
Defining Custom Modules
Importing and Using Custom Modules
Built-In Macros
print! and println!format!
assert!, assert_eq!, and assert_ne!
vec!
panic!
Memory Management
Challenges with Manual ManagementChallenges with Garbage Collection
Ownership & Borrowing
Immutable & Mutable References
Lifetimes
Strings and String Slices
What is a String and a String Slice?String Slices
Strings
Convert Between Slices and Strings
Parse Number from String
Trim String
Print Strings with Interpolation
Tuples
Understanding What a Tuple IsUsing Heterogeneous Elements
Accessing and Destructuring Tuple Elements
Immutability of Tuples
Enums
Defining and Using EnumsExploring Enum Variants and Methods
Pattern Matching with Enums
Working with Result and Option Enums
Enums vs Structs
Structs
What is a Struct?Create Instance
Field Init Shorthand
Struct Update Syntax
Tuple Structs
Unit-Like Structs
Ownership of Struct Data
Function Implementation
Associated Functions
Stuct Methods
Constructor Pattern
Vectors
What is a Vector?Create a Vector
Add and Remove Elements
Access Elements
Iterate over Elements
Slicing, Length, and Capacity
Common Vector Operations
Understand Memory Management
Ownership and Borrowing Rules
Collections and Iterators
Vectors, arrays, and slicesHashMaps and hash sets
Iteration and iterators
Traits
What is a trait?How does a trait related to traditional OOP interfaces?
Defining a trait
Implementing a trait
Default implementations
Traits as parameters
Traits as return types
Traits as bounds
Generics
What is a generic?How does a generic related to traditional OOP generics?
Defining a generic
Implementing a generic
Generic bounds
Multiple generic types
Where clauses
Pattern Matching
What is Pattern Matching?Match Statement
If-Let Statement
While-Let Statement
Destructuring Stucts and Tuples
Pattern Matching with Enums
Pattern Matching with Functions
Pattern Matching and Ownership
Refutability and Irrefutability
Error Handling
Result EnumUnwrap & Expect
Map Error
? Operator
Handle Multiple Error Types with Box Dyn Error
Handle Multiple Error Types with Custom Enum
Handle Multiple Error Types with Anyhow
Concurrent Programming
Introduction to Concurrent Programming ConceptsUsing Multiple Threads in Rust
Working with Mutex, RwLock, and Arc
Message Passing with Channels
Futures and Async/Await for Concurrency
Unsafe Rust
What is Unsafe Rust?Raw Pointers
Dereferencing Raw Pointers
Calling Unsafe Functions
Creating Safe Abstractions
Unsafe Traits
Unsafe Blocks
Unsafe Superpowers
C/C++ FFI
Macros and Metaprogramming
What is a Macro?Define a Macro with macro_rules!
Using Pattern Matching
Define Expansion
Use the Custom Macro
Tests
What is a Test?Test Functions
Test Organization
Test Attributes
Test Coverage
assert!, assert_eq!, and assert_ne!
Documentation with Rustdoc
What is Rustdoc?Add Documentation to Rust Code
Triple-Slash Comments and the #[doc] Attribute
Generate Documentation
Linking and Cross-Referencing Documentation
RustRust ProgrammingOOPCargoSerdeTokioSQLxMutexRwLockAIArtificial IntelligenceChatGPTGithub Copilot