The Complete Rust Programming Reference Guide Rahul Sharma 2024 Scribd Download
The Complete Rust Programming Reference Guide Rahul Sharma 2024 Scribd Download
com
https://textbookfull.com/product/the-complete-rust-
programming-reference-guide-rahul-sharma/
OR CLICK BUTTON
DOWNLOAD NOW
https://textbookfull.com/product/mastering-delphi-programming-a-
complete-reference-guide-primoz-gabrijelcic/
textboxfull.com
https://textbookfull.com/product/the-rust-programming-language-covers-
rust-2018-steve-klabnik/
textboxfull.com
https://textbookfull.com/product/the-rust-programming-language-1st-
edition-steve-klabnik/
textboxfull.com
https://textbookfull.com/product/the-rust-programming-language-2nd-
edition-steve-klabnik/
textboxfull.com
Programming Rust 1st Edition Jim Blandy
https://textbookfull.com/product/programming-rust-1st-edition-jim-
blandy/
textboxfull.com
https://textbookfull.com/product/environmental-issues-of-deep-sea-
mining-impacts-consequences-and-policy-perspectives-rahul-sharma/
textboxfull.com
https://textbookfull.com/product/programming-rust-fast-safe-systems-
development-jim-blandy/
textboxfull.com
https://textbookfull.com/product/programming-webassembly-with-
rust-1st-edition-kevin-hoffman/
textboxfull.com
https://textbookfull.com/product/programming-rust-2nd-edition-early-
release-jim-blandy/
textboxfull.com
The Complete Rust Programming Reference Guide
Rahul Sharma
Vesa Kaihlavirta
Claus Matzinger
BIRMINGHAM - MUMBAI
The Complete Rust
Programming Reference
Guide
Every effort has been made in the preparation of this book to ensure
the accuracy of the information presented. However, the information
contained in this book is sold without warranty, either express or
implied. Neither the authors, nor Packt Publishing or its dealers and
distributors, will be held liable for any damages caused or alleged to
have been caused directly or indirectly by this book.
ISBN 978-1-83882-810-3
www.packtpub.com
mapt.io
Mapt is an online digital library that gives you full access to over
5,000 books and videos, as well as industry leading tools to help you
plan your personal development and advance your career. For more
information, please visit our website.
Why subscribe?
Spend less time learning and more time coding with practical
eBooks and Videos from over 4,000 industry professionals
Improve your learning with Skill Plans built especially for you
developers and tech professionals, just like you, to help them share
their insight with the global tech community. You can make a
general application, apply for a specific hot topic that we are
recruiting an author for, or submit your own idea.
Table of Contents
Title Page
Copyright
About Packt
Why subscribe?
Packt.com
Contributors
Preface
Who this book is for
Conventions used
Get in touch
Reviews
Using rustup.rs
Primitive types
Closures
Strings
Match expressions
Loops
User-defined types
Structs
Enums
Collections
Arrays
Tuples
Vectors
Hashmaps
Slices
Iterators
Summary
Package managers
Modules
Nested modules
File as a module
Directory as module
Cargo workspace
Extending Cargo and tools
cargo-edit
cargo-deb
cargo-outdated
Linting code with clippy
Organizing tests
Testing primitives
Attributes
Assertion macros
Unit tests
First unit test
Running tests
Isolating test code
Failing tests
Ignoring tests
Integration tests
First integration test
Writing documentation
Generating and viewing documentation
Hosting documentation
Doc attributes
Documentation tests
Benchmarks
Summary
4. Types, Generics, and Traits
Generic types
Generic implementations
Using generics
Abstracting behavior with traits
Traits
The many forms of traits
Marker traits
Simple traits
Generic traits
Memory safety
Trifecta of memory safety
Ownership
A brief on scopes
Ownership in action
Borrowing
Borrowing rules
Borrowing in action
Lifetime subtyping
Specifying lifetime bounds on generic types
Pointer types in Rust
References – safe pointers
Raw pointers
Smart pointers
Drop
Deref and DerefMut
Interior mutability
Cell<T>
RefCell<T>
Uses of interior mutability
Summary
6. Error Handling
Error handling prelude
Recoverable errors
Option
Result
Combinators on Option/Result
Common combinators
Using combinators
Converting between Option and Result
Early returns and the ? operator
Non-recoverable errors
User-friendly panics
Custom errors and the Error trait
Summary
7. Advanced Concepts
Joining strings
When to use &str versus String ?
Global values
Constants
Statics
Compile time functions – const fn
Dynamic statics using the lazy_static! macro
Iterators
Fn closures
FnMut closures
FnOnce closures
Consts in structs, enums, and traits
Re-exports
Selective privacy
Advanced match patterns and guards
Match guards
8. Concurrency
Approaches to concurrency
Kernel-based
User-level
Pitfalls
Concurrency in Rust
Thread basics
Customizing threads
Accessing data from threads
RwLock
Communicating through message passing
Asynchronous channels
Synchronous channels
thread-safety in Rust
What is thread-safety?
Traits for thread-safety
Send
Sync
Concurrency using the actor model
Other crates
Summary
What is metaprogramming?
When to use and not use Rust macros
Types of macros
Creating your first macro with macro_rules!
Repetitions in macros
Exercises
Procedural macros
Derive macros
Debugging macros
Useful procedural macro crates
Summary
10. Unsafe Rust and Foreign Function Interfaces
Summary
11. Logging
What is logging and why do we need it?
Unstructured logging
Structured logging
Logging in Rust
log4rs
Mio
Futures
Tokio
Building an asynchronous redis server
Summary
Web frameworks
Actix-web basics
Summary
14. Lists, Lists, and More Lists
Linked lists
A transaction log
Adding entries
Log replay
After use
Wrap up
Upsides
Downsides
Reverse
Wrap up
Upsides
Downsides
Skip lists
The list
Adding data
Leveling up
Jumping around
Upsides
Downsides
Dynamic arrays
Favorite transactions
Internal arrays
Quick access
Wrap up
Upsides
Downsides
Summary
Further reading
Upsides
Downsides
Red-black tree
Upsides
Downsides
Heaps
A huge inbox
Getting messages in
Wrap up
Upsides
Downsides
Trie
More realistic IoT device management
Adding paths
Walking
Wrap up
Upsides
Downsides
B-Tree
An IoT database
Adding stuff
Wrap up
Upsides
Downsides
Graphs
Wrap up
Upsides
Downsides
Summary
Hashing
Create your own
Message digestion
Wrap up
Maps
A location cache
The hash function
Adding locations
Fetching locations
Wrap up
Upsides
Downsides
Sets
Union
Intersection
Difference
Wrap up
Upsides
Downsides
Summary
Further reading
Sequences
Vec<T> and VecDeque<T>
Architecture
Insert
Look up
Remove
LinkedList<T>
Architecture
Insert
Look up
Remove
Wrap up
Maps and sets
Insert
Lookup
Remove
Architecture
Insert
Look up
Remove
Wrap up
Summary
Further reading
Loops
Recursion
Complexity classes
O(1)
O(log(n))
O(n)
O(n log(n))
O(n²)
O(2n)
Comparison
In the wild
Data structures
Everyday things
Exotic things
Summary
Further reading
Shell sort
Heap sort
Merge sort
Quicksort
Summary
Further reading
Linear searches
Jump search
Binary searching
Wrap up
Summary
Further reading
LCG
Wichmann-Hill
The rand crate
Back to front
Dynamic programming
Metaheuristic approaches
Example metaheuristic – genetic algorithms
Summary
Further reading
Slices
Search
Linear search
Binary search
Sorting
Stable sorting
Unstable sorting
Summary
Further reading
Our website is not just a platform for buying books, but a bridge
connecting readers to the timeless values of culture and wisdom. With
an elegant, user-friendly interface and an intelligent search system,
we are committed to providing a quick and convenient shopping
experience. Additionally, our special promotions and home delivery
services ensure that you save time and fully enjoy the joy of reading.
textbookfull.com