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

9

Working with C++ in Rust

We've been focusing specifically on Rust for a few chapters, but now it's time to delve back into C++. While ideally, all our software would be able to benefit from Rust's safety guarantees, the reality remains that there are many libraries written in C and C++ that we may wish to use as part of our Rust programs. Or, perhaps we want to leverage Rust inside a completely different programming language ecosystem. Whether we're replacing an older system with Rust piece by piece or creating extensions for a third language such as Python, understanding how to use Rust to interact with other languages is an essential skill.

In this chapter, we'll discover Rust's Foreign Function Interface (FFI). The FFI refers to the set of language features that allow us to call functions from other languages in our Rust code and to make our Rust functions and data types available to other languages.

In this chapter, we're going...

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