Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Rust for C++ Developers
  • Table Of Contents Toc
Rust for C++ Developers

Rust for C++ Developers

By : Dan Olson
close
close
Rust for C++ Developers

Rust for C++ Developers

By: Dan Olson

Overview of this book

If you're a C++ programmer curious about the rising popularity of Rust, this book will guide you through the transition with clarity and purpose. Written by a veteran C++ developer who embraced Rust to improve software quality and maintainability, this hands-on guide shows you how to apply your existing knowledge to build efficient and safe systems with Rust. The first half of the book deep dives into Rust’s history, safety guarantees, and development tooling. From there, the book compares Rust and C++ side by side, covering syntax, SIMD instructions, file I/O, object orientation, and data structures. With each chapter, you’ll gain a practical understanding of Rust’s unique approaches—like ownership and borrowing—and how they solve long-standing challenges in C++. Later half of the book tackles performance optimization, multithreading, macros, and foreign function interfaces, culminating in a complete project where you reimplement a C++ program in Rust. By focusing on real-world code and familiar concepts, this book makes Rust accessible and actionable for experienced C++ developers. By the end of Rust for C++ Developers, you’ll be confident in your ability to read, write, and maintain production-grade Rust code, and you’ll have a clear roadmap for integrating Rust into your future projects.
Table of Contents (20 chapters)
close
close
Lock Free Chapter
1
Part 1: Understanding Rust Basics
6
Part 2: Exploring the Rust Standard Library
12
Part 3: Moving into Advanced Rust
18
Index

Using dictionary types

Dictionary types, also referred to as associative arrays or simply maps, are an important data structure in many types of programs. Conceptually, they map a series of keys to a single value each, where the key and value may be different types. We'll examine how Rust implements maps in this section, and we'll also examine their close cousin, the set, which is a special case of a map with no values. Both map and set types will collectively be referred to as dictionary types throughout this section.

Flavors of map and set in Rust

Rust offers two "flavors" of map and set structures in its standard library. The first flavor is the hash flavor. The HashMap and HashSet types in the std::collections module store their data by creating a hash of the key and using that hash to pick a spot in memory to store the value. This means that the internal data is not sorted in any useful, human-interpretable way. The hash flavor roughly corresponds...

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.
Rust for C++ Developers
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon