
The Complete Rust Programming Reference Guide
Design, develop, and deploy effective software systems using the advanced constructs of Rust
- 698 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
The Complete Rust Programming Reference Guide
Design, develop, and deploy effective software systems using the advanced constructs of Rust
About this book
Design and implement professional-level programs by leveraging modern data structures and algorithms in Rust
Key Features
- Improve your productivity by writing more simple and easy code in Rust
- Discover the functional and reactive implementations of traditional data structures
- Delve into new domains of Rust, including WebAssembly, networking, and command-line tools
Book Description
Rust is a powerful language with a rare combination of safety, speed, and zero-cost abstractions. This Learning Path is filled with clear and simple explanations of its features along with real-world examples, demonstrating how you can build robust, scalable, and reliable programs.
You'll get started with an introduction to Rust data structures, algorithms, and essential language constructs. Next, you will understand how to store data using linked lists, arrays, stacks, and queues. You'll also learn to implement sorting and searching algorithms, such as Brute Force algorithms, Greedy algorithms, Dynamic Programming, and Backtracking. As you progress, you'll pick up on using Rust for systems programming, network programming, and the web. You'll then move on to discover a variety of techniques, right from writing memory-safe code, to building idiomatic Rust libraries, and even advanced macros.
By the end of this Learning Path, you'll be able to implement Rust for enterprise projects, writing better tests and documentation, designing for performance, and creating idiomatic Rust code.
This Learning Path includes content from the following Packt products:
- Mastering Rust - Second Edition by Rahul Sharma and Vesa Kaihlavirta
- Hands-On Data Structures and Algorithms with Rust by Claus Matzinger
What you will learn
- Design and implement complex data structures in Rust
- Create and use well-tested and reusable components with Rust
- Understand the basics of multithreaded programming and advanced algorithm design
- Explore application profiling based on benchmarking and testing
- Study and apply best practices and strategies in error handling
- Create efficient web applications with the Actix-web framework
- Use Diesel for type-safe database interactions in your web application
Who this book is for
If you are already familiar with an imperative language and now want to progress from being a beginner to an intermediate-level Rust programmer, this Learning Path is for you. Developers who are already familiar with Rust and want to delve deeper into the essential data structures and algorithms in Rust will also find this Learning Path useful.
Frequently asked questions
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Information
Robust Trees
- Implementing and understanding a binary search tree
- Learning about self-balancing trees
- How prefix or suffix trees work
- What a priority queue uses internally
- Graphs, the most general tree structure
Binary search tree
type Tree = Option<Box<Node>>;
struct Node {
pub value: u64,
left: Tree,
right: Tree,
}
pub struct BinarySearchTree {
root: Tree,
pub length: u64,
}
IoT device management
- Store IoT device objects (containing the IP address, numerical name, and type)
- Retrieve IoT objects by numerical name
- Iterate over IoT objects
#[derive(Clone, Debug)]
pub struct IoTDevice {
pub numerical_id: u64,
pub address: String,
}
type Tree = Option<Box<Node>>;
struct Node {
pub dev: IoTDevice,
left: Tree,
right: Tree,
}
More devices
1
/ \
2
/ \
3
/ \
4
pub fn add(&mut self, device: IoTDevice) {
self.length += 1;
let root = mem::replace(&mut self.root, None);
self.root = self.add_rec(root, device);
}
fn add_rec(&mut self, node: Tree, device: IoTDevice) -> Tree {
match node {
Some(mut n) => {
if n.dev.numerical_id <= device.numerical_id {
n.left = self.add_rec(n.left, device);
Some(n)
} else {
n.right = self.add_rec(n.right, device);
Some(n)
}
}
_ => Node::new(device),
}
}
Table of contents
- Title Page
- Copyright
- About Packt
- Contributors
- Preface
- Getting Started with Rust
- Managing Projects with Cargo
- Tests, Documentation, and Benchmarks
- Types, Generics, and Traits
- Memory Management and Safety
- Error Handling
- Advanced Concepts
- Concurrency
- Metaprogramming with Macros
- Unsafe Rust and Foreign Function Interfaces
- Logging
- Network Programming in Rust
- Building Web Applications with Rust
- Lists, Lists, and More Lists
- Robust Trees
- Exploring Maps and Sets
- Collections in Rust
- Algorithm Evaluation
- Ordering Things
- Finding Stuff
- Random and Combinatorial
- Algorithms of the Standard Library
- Other Books You May Enjoy