liveBook · Manning

Arc

Arc is Rust’s atomically reference-counted smart pointer, which enables shared ownership of a value across threads.

How 3 Manning books explain it

Code Like a Pro in Rust

Arc is a Rust thread-safe reference-counted smart pointer for shared ownership of a value across threads.

How it is used
Uses Arc for shared ownership across threads and shared state in parallel tests.
How deep it goes
Explains reference counts, atomic costs, synchronization, and clone-on-write, while deferring detailed Send and Sync treatment.
Examples
Demonstrates a global AtomicI32 test counter wrapped in Arc and initialized with lazy_static, then shows an alternative without Arc.
What you can do after
Apply Arc to shared ownership and choose synchronization or clone-on-write for appropriate mutation needs.

Read how Code Like a Pro in Rust explains Arc →

Rust Web Development

Arc is Rust’s atomically reference-counted shared pointer type, which allows multiple owners to access heap-allocated data.

How it is used
Shares one heap-allocated application store across multithreaded REST handlers without copying the store.
How deep it goes
Explains heap placement, pointer cloning, reference-count changes, and dropping at zero; defers mutation safety to locks.
Examples
Uses a HashMap-backed question store wrapped in Arc<RwLock<...>>.
What you can do after
Apply it by wrapping a shared store in Arc and pairing it with a lock when handlers need mutation.

Read how Rust Web Development explains Arc →

Learn Rust in a Month of Lunches

Arc is Rust's atomically reference-counted smart pointer for sharing ownership of a value safely across threads.

How it is used
Shares ownership of values across threads while coordinating access through thread-safe types.
How deep it goes
Defines atomic operations and demonstrates cloning, locking, spawning, joining, and repeated shared-counter updates.
Examples
Uses Arc<Mutex<i32>> counters, two-thread increments, ten-thread loops, and helper functions that construct and clone Arcs.
What you can do after
Build shared counters with Arc, Mutex, spawned threads, cloned owners, and joined handles.

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

Also covered in

What to know first

Related concepts

Questions about Arc

What is Arc?

Arc is Rust’s atomically reference-counted smart pointer, which enables shared ownership of a value across threads.

Which Manning books explain Arc?

Code Like a Pro in Rust, Rust Web Development and Learn Rust in a Month of Lunches.

What should I know before learning Arc?

Manning books that teach Arc usually introduce locking, borrow checker and heap first.

What is the difference between Arc and Rc?

Arc is Rust’s atomically reference-counted smart pointer, which enables shared ownership of a value across threads. Rc is Rust’s single-threaded reference-counted smart pointer for shared ownership of a value.

What is Arc a kind of?

Arc is a kind of smart pointer. A smart pointer is a pointer-like object that manages or mediates access to a referenced resource, often providing ownership, lifetime, or safety behavior.

What are the parts of Arc?

Arc includes locking and rwlock.

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.