liveBook · Manning

Rc

Rc is Rust’s single-threaded reference-counted smart pointer for shared ownership of a value.

How 2 Manning books explain it

Code Like a Pro in Rust

Rc is Rust's single-threaded reference-counted smart-pointer type for shared ownership of a value.

How it is used
Provides single-threaded shared ownership for structures such as doubly linked lists.
How deep it goes
Explains count increments and decrements, then shows an Rc-based node representation; leaves raw-pointer implementation as an exercise.
Examples
Uses a doubly linked list whose node references are `Rc<RefCell<ListItem<T>>>`.
What you can do after
Apply it via `Rc` for single-threaded shared ownership, pairing it with `RefCell` when shared nodes need mutation.

Read how Code Like a Pro in Rust explains Rc →

Learn Rust in a Month of Lunches

Rc is Rust's reference-counting smart pointer type for shared ownership of data while tracking the number of active owning references.

How it is used
Shares owned data across structures or calls when unique ownership or full cloning is inconvenient.
How deep it goes
Explains construction, cloning, owner counts, weak references, cycles, and lifetime avoidance through worked examples.
Examples
Uses moved Strings, shared city names and histories, repeated function calls, owner counts, and nested city-country-world structs.
What you can do after
Apply it via std::rc::Rc to share data, inspect strong counts, and replace selected lifetime-heavy string references.

Read how Learn Rust in a Month of Lunches explains Rc →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.