Open-source project
nrc/r4cppp avatar
nrc/r4cppp

r4cppp: A Rust Tutorial for Systems Programmers Who Already Know C++

Rust for C++ programmers

3,893 stars297 forksRustNOASSERTION

At a glance

What is it?
r4cppp (Rust for C++ Programmers) is an open tutorial that teaches Rust by explaining where and why it diverges from C++, rather than covering basics that experienced systems programmers already know. It assumes familiarity with pointers, references, memory management, and integer widths, and spends most of its pages on ownership, borrowing, lifetimes, and the type system.
Who is it for?
r4cppp is the right starting resource for a C or C++ developer who already understands memory management, templates, and systems-level constraints and wants to map that knowledge onto Rust quickly without sitting through introductory material. It is not a complete Rust reference: the README explicitly points to the Rust Book as the place for full coverage and for topics not included here, such as tooling, cargo configuration, or the standard library API.
Can I use it commercially?
Check first. The repository uses a licence we do not classify automatically, so read its LICENSE file before any commercial use.
Is it still maintained?
Yes. The repository last received commits 105 days ago.
What is it written in?
Mainly Rust, according to GitHub's language statistics.

Answers come from the project's GitHub data, last synced on September 30, 2026, and from our analysis. They are not legal advice.

Editorial analysis

What r4cppp Covers and What It Skips

Most Rust tutorials are written for a general audience. They start from scratch: variables, loops, functions. A C++ developer reading one spends the first quarter of the material re-learning things they already know.

r4cppp takes a different approach. The README states its intent plainly: cover the differences between Rust and C++ to get you writing Rust programs quickly, without repeating things the intended audience already knows. The author, Nick Cameron (@nrc), wrote it originally as a series of blog posts while learning Rust himself, partly as a way to solidify understanding and partly because he found existing resources unsatisfying for an experienced C++ audience.

The material is organised as a flat sequence of chapters, each as a separate Markdown file. The contents list twelve chapters: Hello World, control flow, primitive types and operators, unique pointers, borrowed pointers, Rc and raw pointers, data types, destructuring (two parts), arrays and vecs, graphs and arena allocation, and closures and first-class functions.

Topics that overlap heavily with what C++ developers already know are kept brief. The chapter on control flow covers Rust-specific syntax rather than explaining what a for loop is. The chapters on pointers cover the Rust ownership and borrowing model, which has no direct C++ equivalent, in detail.

The Core Content: Ownership, Borrowing, and Lifetimes

The intellectual core of r4cppp is the sequence on pointers, which spans three chapters: unique pointers, borrowed pointers, and Rc and raw pointers.

The README summarises the author's experience: the biggest difference between Rust and C++ is that Rust strictly enforces at compile time what C++ programmers think of as good practices for memory safety. The ownership system, which assigns a single owner to each value and enforces the owner's scope as the value's lifetime, maps onto ideas that experienced C++ programmers have around RAII and unique_ptr. Borrowed references, which can be either shared and immutable or exclusive and mutable but never both at the same time, are an enforcement of aliasing rules that C++ leaves to the programmer.

Lifetime annotations, which the README acknowledges require new type annotation syntax, communicate the relationship between reference lifetimes to the compiler. The README notes that if you have a strong idea of object lifetimes and experience with generic programming, they should not be too difficult to learn, but the initial compiler friction can be significant.

The chapter on Rc and raw pointers covers the cases that single ownership cannot handle: reference-counted shared ownership and, in unsafe code, raw pointers. The graphs and arena allocation chapter extends this to a practical worked example of a data structure that is difficult to express without raw pointers or arena allocation.

How to Navigate the Repository

The repository is a flat collection of Markdown files at the top level. Each chapter is a separate file: hello-world.md, control-flow.md, primitives.md, unique.md, borrowed.md, rc-raw.md, data-types.md, destructuring.md, destructuring-2.md, arrays.md, closures.md. The graphs chapter is in a subdirectory: graphs/README.md.

There is no build system, no generated site, and no package to install. The chapters render directly on GitHub as Markdown. Reading them in order from the README's contents list is the intended path.

To clone the repository and read locally:

bash
git clone https://github.com/nrc/r4cppp.git

After cloning, any Markdown viewer or plain text editor gives access to all chapters. The files are self-contained and cross-reference each other through relative links.

The README provides links to three complementary external resources: the official Rust Book (recommended for topics not covered here or for a second opinion), the Rust API documentation, and the Rust Reference Manual. These are not part of the repository.

Where r4cppp Is Thin and What Is Not Covered

The tutorial has twelve chapters. The standard library, cargo and the build system, testing, macros, async/await, and the trait system are not covered. The README does not describe this as an omission but as a deliberate scope: the material is about the concepts that are different from C++, not a comprehensive introduction to every Rust feature.

The README cites several topics it would welcome in contributions: edge cases like using a different build system from Cargo, writing syntax extensions, using unstable APIs, and in-depth treatment of topics already covered at a high level. This suggests that the existing chapters are not exhaustive and that contributors have room to deepen coverage.

The data types and closures chapters address topics that have partial equivalents in C++ (structs and enums versus sum types; lambdas versus closures). The tutorial explains Rust's versions and highlights the constraints Rust enforces that C++ does not, but it does not cover Rust's trait system comprehensively. Users who need to understand trait objects, generics with trait bounds, or the Iterator trait will need to go to the Rust Book.

The graphs and arena allocation chapter is the most advanced and covers a genuinely difficult topic for C++ developers accustomed to raw pointers: how to represent a graph in Rust where nodes hold references to each other. The chapter demonstrates both the difficulty and two solutions.

Contributing to r4cppp

The CONTRIBUTING section of the README describes the project as open to additions, corrections, and new chapters. The author encourages pull requests for typos and mistakes, requests issues for larger changes or new chapters, and is open to re-organisation of existing work or expanded examples.

The style guidance is specific: the intended audience is C++ programmers; material should not overlap heavily with the Rust Book; British English is preferred (though American English localisations are explicitly welcomed); lines should be at most 80 columns; no exercises or mini-project suggestions.

The repository is hosted under the account of Nick Cameron (@nrc), who is identified in the README as a Rust contributor. Contributions are handled through standard GitHub pull requests and issues. There is no code of conduct document listed in the top-level entries, which consist of Markdown files and a compile_pdf.sh script.

Maintenance Status and Licence

The last push to the repository was on 2026-06-17. The repository is not archived. There are no GitHub releases; the master branch is the delivery vehicle.

The licence is listed as NOASSERTION in the repository metadata, which means no standard SPDX licence identifier was detected. The repository does include a LICENSE.md file. Users who need to assess licence compatibility for redistribution or commercial use should read that file directly rather than relying on the metadata tag.

The README itself notes that the documentation for Rust has improved significantly since the tutorial was first written, and that the official Rust Book is the better resource for completeness. r4cppp's continued value is its targeted angle: concepts for people who already know C++ and want to understand specifically where and why Rust differs.

Editorial conclusion

r4cppp is the right starting resource for a C or C++ developer who already understands memory management, templates, and systems-level constraints and wants to map that knowledge onto Rust quickly without sitting through introductory material. It is not a complete Rust reference: the README explicitly points to the Rust Book as the place for full coverage and for topics not included here, such as tooling, cargo configuration, or the standard library API. The last push was on 2026-06-17. The repository is not archived, and contributions are open, but new chapters depend on volunteer effort rather than a committed maintenance schedule. Verify that the covered chapters match the Rust version you are targeting, since the README itself notes that some external references it links (such as StackOverflow answers about Rust) may be outdated due to the language's evolution.

Frequently asked questions

What does r4cppp cover that the Rust Book does not?

r4cppp focuses specifically on the differences between Rust and C++, skipping basics that C++ programmers already know. The README describes it as targeting concepts that are explained better using low-level, systems-level intuitions rather than higher-level abstractions found in general-audience tutorials.

Does r4cppp include exercises or projects to complete?

No. The README explicitly states there are no plans to add exercises or mini-project suggestions. The material is descriptive and explanatory rather than exercise-driven.

Which Rust topics are not covered in r4cppp?

The tutorial does not cover the build tool Cargo in depth, macros, async/await, the full trait system, testing, or most of the standard library. The README points to the official Rust Book and API documentation for those areas.

Official sources

  1. Issues
  2. nrc/r4cppp on GitHub
  3. README
Add this badge to your README

If you maintain this project, the badge below links readers to this analysis and shows its maintenance status from the daily GitHub snapshot. Paste the markdown into your README; add ?metric=license or ?metric=stars to the image URL for a different field.

Add this badge to your README

markdown
[![Hysen Labs](https://hysenlabs.com/badge/nrc-r4cppp.svg)](https://hysenlabs.com/projects/nrc-r4cppp)