liveBook · Manning

Arc

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

How 2 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
Enables shared ownership across threads and appears in a parallel-test counter.
How deep it goes
Explains reference-count changes and atomic cost, then works through global initialization; stops short of implementing Arc.
Examples
Uses a parallel-test counter, compiler errors, `Arc::clone`, and `lazy_static!` to expose an initialization pitfall.
What you can do after
Apply it via Rust's `Arc` when ownership crosses threads, choosing synchronization or clone-on-write separately.

Read how Code Like a Pro in Rust 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 →

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.