Rust Programming Masterclass from Beginner to Expert

Video description

In the world of programming languages, there are often tradeoffs to consider. Low-level languages such as C and C++ offer speed and control, but at the cost of memory safety. High-level languages such as Python and JavaScript prioritize safety but are less efficient in terms of power and speed. Rust, however, offers the best of both worlds.

You will begin with the basics of Rust programming, including its syntax and memory safety features. As you progress, you will develop an understanding of advanced-level concepts such as generics, traits, and more. The course provides hands-on experience in solving intermediate to advanced-level problems using Rust.

The course covers a range of topics, including basic Rust programming syntax, Enums, structures, rust module system, the use of external crates and publishing crates, smart pointers, commonly used data structures, advanced techniques such as macros, testing, memory allocations and more. You will also learn some real-life applications in Rust from scratch, and efficient programming skills.

Furthermore, you will understand concurrency and async programming, textual processing, directory handling, Blockchain, and web programming in Rust.

By the end of this course, you will become fluent in Rust programming and confidently and professionally code in the language.

What you will learn

  • Use Rust syntax and collectors to write basic programs
  • Apply enums, traits, structures, generics, and more to create complex programs
  • Utilize advanced Rust techniques, such as macros and testing, for efficient programming
  • Apply Rust to create real-life applications such as blockchain and web programming
  • Handle options, strings, and structures in concurrent and asynchronous programs
  • Learn performance optimization techniques and benchmarking using Criterion

Audience

This course is designed for beginners who have no prior knowledge of Rust and who are interested in learning the language. However, the book also covers advanced concepts, making it suitable for individuals who want to develop their skills and expertise in Rust programming. It may be particularly useful for students, professionals, or hobbyists who are interested in system programming, blockchain development, or other related areas.

About the Author

Dr. Nouman Azam: Dr. Nouman Azam, an assistant professor of Computer Science at the National University of Computer and Emerging Sciences, specializes in machine learning with a focus on applications in bioinformatics, text processing, and medical decision-making.

He leverages over a decade of research and teaching experience to bridge technology with real-world challenges. His research integrates complex theories such as rough sets, game theory, and optimization into practical machine learning applications. In his master's thesis, he investigated various machine-learning techniques for identifying key features in spam email filtering. His doctoral research focused on using algorithms like genetic algorithms and gradient descent to discern patterns in data.

Table of contents

  1. Chapter 1 : Introduction
    1. Course Introduction
    2. Installing Rust and VS Code Editor
    3. Running and Compiling Your First Program
  2. Chapter 2 : Basic Programming
    1. Program Outputs and Comments
    2. Variables and Scalar Data Types
    3. More on Variables - Shadowing, Constants
    4. Compound Data Types - Strings
    5. Compound Data Types - Tuples, Arrays
    6. Compound Data Types - Vectors
    7. Functions and Inputs
  3. Chapter 3 : Ownership - The Heart of Rust Programming
    1. Ownership, Primitive, and Non-Primitive Types
    2. Application Memory - Heap and Stack
    3. Ownership and References in Functions
    4. Mutable and Immutable References
    5. Dereferencing
  4. Chapter 4 : Control Structures
    1. Conditional If and Its Variants
    2. If Let and Nested If
    3. Match Statement
    4. While and Simple Loops
    5. For Loops and Their Variants
    6. Break and Continue
  5. Chapter 5 : Project: Stack Implementation
    1. Implementing Stack
    2. String Reversal Using Stacks
    3. Expression Evaluation (Infix to Postfix Illustration)
    4. Expression Evaluation (Postfix Evaluation)
    5. Expression Evaluation - Part 1
    6. Expression Evaluation - Part 2
    7. Implementing Postfix Evaluation
  6. Chapter 6 : Structures, Traits, Generics, Enums
    1. Structures Basics
    2. Traits and Default Implementations
    3. Functions within a Trait
    4. Enums
    5. Generics
    6. Option Enum
    7. Result Enum
    8. Hash Maps
  7. Chapter 7 : Iterators, Lifetimes, and Closures
    1. Lifetimes - Part 1
    2. Lifetimes - Part 2
    3. Eliding Lifetimes
    4. Closures - Part 1
    5. Closures - Part 2
    6. Function Types
    7. Iterators - Part 1
    8. Iterators - Part 2
  8. Chapter 8 : Rust Modules and Crates
    1. Rust Modules (Part 1)
    2. Rust Modules (Part 2)
    3. Cargo tools to Visualize Module Hierarchy
    4. Re-Exporting using Pub use
    5. Using External Crates
    6. Publishing Your Crate
  9. Chapter 9 : Smart Pointers
    1. Basics of Smart Pointers
    2. Box Smart Pointers and When to Use It
    3. Refining Cons List and Custom-Defined Smart Pointers
    4. Singly Link List (Part 1)
    5. Singly Link List (Part 2)
    6. Generics and Deref Coercion in Smart Pointers
    7. Rc Smart Pointer
    8. RefCell Smart Pointer
    9. Doubly Link List (Part 1)
    10. Doubly Link List (Part 2)
    11. Reference Cycles Creating Memory Leakage
  10. Chapter 10 : Advance Techniques
    1. Macros Basic
    2. Capturing Types
    3. Repeating Patterns
    4. Unit Type, Expression Versus Statements, and Partial Move
    5. As_ref and Partial Move in Option
    6. Take and Swap for Avoiding Allocations
    7. Question Mark Operator
    8. Testing Your Code (Part 1)
    9. Testing Your Code (Part 2)
    10. Testing Your Code (Part 3)
  11. Chapter 11 : Real-Life Applications and Problem-Solving Using Rust
    1. Search Results Using Word Groupings with HashMaps and Nested Loops
    2. Product Popularity Using HashMaps
    3. Highest Stock Price Using MaxStack and Structures
    4. Finding an Employee with No Meeting Using Multidimensional Arrays
    5. Longest Non-Stop Working Employee Using HashSets
    6. Items Suggestions Using HashSets and Vectors
    7. Items in Ranges Using Binary Search Tree (Part 1)
    8. Items in Ranges Using Binary Search Tree (Part 2)
    9. Fetching Top Products
    10. Effective Storage and Retrieval Using Trie Data Structure
    11. Most Recently Used Product Using Doubly Link List and HashMaps (Part 1)
    12. Most Recently Used Product Using Doubly Link List and HashMaps (Part 2)
    13. Displaying Participants in an Online Meeting (Part 1)
    14. Displaying Participants in an Online Meeting (Part 2)
  12. Chapter 12 : Deep Dive Into Traits
    1. Trait Bounds
    2. Associated Types
    3. Trait Items
    4. Scope of a Trait, Marker, and Super Trait
    5. Some Useful Traits
    6. Static Versus Dynamic Dispatch (Trait Objects)
  13. Chapter 13 : Efficient Programming with Rust
    1. Initializing Struct Instances
    2. Function Inputs and Coercion
    3. Iterating Through Option
    4. Disabling Mutability for Finalized Objects
    5. String Concatenation and Ownership
    6. Simplifying Structures
    7. Efficient Programming Tips
    8. String Literals
    9. Todo Macro and Some Useful Extensions
    10. The Builder Pattern
  14. Chapter 14 : Concurrency
    1. Threads Basics
    2. Multiple Threads and Ownership in Threads
    3. Communication through Channels
    4. Multiple Producers, Threads, and Functions
    5. Sharing States
    6. Passing Mutexes between Threads
    7. Synchronization Through Barriers
    8. Project: Web Scraping Using Threads
    9. Scoped Threads
    10. Thread Parking, Yielding
    11. Async Await
    12. Async Await (Tasks and Select)
  15. Chapter 15 : Text Processing, File and Directory Handling
    1. Basic File Handling
    2. Directory and Path-Related Functions
    3. Regular Expressions Basics
    4. Repetitions Quantifiers and Capturing Groups
  16. Chapter 16 : A Deeper Look at the Sized and Unsized Types in Rust
    1. Unsized types and References to them
    2. Possibly Sized property
    3. Rust Provided Non-Sized types
    4. Coercion in Unsized Types
  17. Chapter 17 : Blockchain in Rust
    1. Blockchain Theory (Part 1: Hashes)
    2. Blockchain Theory (Part 2: Blocks and Blockchain)
    3. Blockchain in Rust (Part 1: Basic Structures and Functions)
    4. Blockchain in Rust (Part 2: Chain Validation and Selection)
  18. Chapter 18 : Web Programming
    1. Web Programming Basics
    2. Making Responses
    3. Multiple Requests Using Threads
  19. Chapter 19 : Measuring and Improving Performance
    1. Benchmarking Using Criterion
    2. Performance Lints

Product information

  • Title: Rust Programming Masterclass from Beginner to Expert
  • Author(s): Dr. Nouman Azam
  • Release date: May 2024
  • Publisher(s): Packt Publishing
  • ISBN: 9781804612187