Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
Arrow up icon
GO TO TOP
The Rust Programming Handbook

You're reading from   The Rust Programming Handbook An end-to-end guide to mastering Rust fundamentals

Arrow left icon
Product type Paperback
Published in Dec 2025
Publisher Packt
ISBN-13 9781836208877
Length 768 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Francesco Ciulla Francesco Ciulla
Author Profile Icon Francesco Ciulla
Francesco Ciulla
Arrow right icon
View More author details
Toc

Table of Contents (20) Chapters Close

Preface 1. Getting Started with Rust 2. Rust Syntax and Functions FREE CHAPTER 3. Functions in Rust 4. Ownership, Borrowing, and References 5. Composite Types in Rust and the Module System 6. Introduction to Error Handling 7. Polymorphism and Lifetimes 8. Object-Oriented Programming in Rust 9. Thinking Functionally in Rust 10. Testing in Rust 11. Smart Pointers and Memory Management 12. Managing System Resources 13. Concurrency and Parallelism 14. Rust for Web Development: Building Full-Stack Applications 15. System Programming in Rust: Concrete Examples 16. Dockerization and Deployment of Rust Applications 17. Unlock Your Exclusive Benefits 18. Other Books You May Enjoy
19. Index

Object-oriented design patterns in Rust

Introduction to patterns in Rust

While Rust isn’t traditionally OOP, many common software design patterns can be effectively implemented by leveraging traits, enums, and composition. What makes this particularly powerful is how Rust’s core features often lead to more robust and type-safe versions of these patterns than in other languages.

For example, Rust’s expressive enums are perfect for creating compile-time verified state machines (the State pattern), while the ownership system provides a natural and safe way to manage resource construction (the Builder pattern).

The borrow checker adds another layer of safety, preventing invalid state mutations at compile time. This means you can implement familiar patterns with a higher degree of confidence in their correctness.

Builder pattern

The Builder pattern is useful when constructing an object with many fields, especially if many are optional or require...

lock icon The rest of the chapter is locked
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
The Rust Programming Handbook
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Modal Close icon
Modal Close icon