liveBook · Manning

Move

Move semantics are language rules that transfer a value or its resources to another binding or object without copying them, potentially making the original binding unavailable.

How 6 Manning books explain it

100 C++ Mistakes and How to Avoid Them

How it is used
Uses moves to transfer exclusive resources without paying for unnecessary copies.
How deep it goes
Explains move construction, assignment, source neutralization, and std::move through resource-owning class examples.
Examples
Contrasts Page ownership-transfer constructors and moves a unique_ptr managing a Buffer.
What you can do after
Apply move semantics in resource-owning classes and transfer exclusive ownership with std::move and unique_ptr.

Read how 100 C++ Mistakes and How to Avoid Them explains move →

Learn Rust in a Month of Lunches

Move semantics is the behavior in which transferring a non-Copy value transfers its ownership and prevents use of the original binding.

How it is used
Explains ownership transfer when passing values to functions and capturing values in thread closures.
How deep it goes
Walks through moved-value and closure-lifetime errors, showing borrowing, returning ownership, cloning, and move captures as responses.
Examples
Uses a country String passed twice to a print function and a String captured by a spawned thread.
What you can do after
Diagnose/debug with compiler messages for moved values and thread closures that borrow data that may not live long enough.

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

Refactoring to Rust

Move semantics is Rust's ownership-transfer behavior, under which a value becomes inaccessible through its original binding after transfer.

How it is used
Explains why passing owned values into functions makes the original bindings inaccessible.
How deep it goes
Explains ownership transfer, scope-based dropping, and lifetime graphs, without extending beyond these introductory examples.
Examples
Uses Artwork values, admire_art calls, compiler diagnostics, and lifetime graphs.
What you can do after
Diagnose use-of-moved-value errors by tracing ownership transfers and lifetime disappearance across function calls.

Read how Refactoring to Rust explains move →

Rust in Action: Systems programming concepts and techniques

Move semantics define how transferring ownership of a value invalidates or relocates its previous binding instead of implicitly copying the value.

How it is used
Explains why Rust rejects later uses of values passed to functions, reassigned, returned, or captured by spawned closures.
How deep it goes
Traces assignment, arguments, returns, and closure captures with compiler errors and working listings, but defers deeper capture details.
Examples
Uses CubeSat status checks, a returned CubeSat, compiler diagnostics, and shared pause values in spawned threads.
What you can do after
Diagnose/debug with it by reading moved-value and closure-lifetime errors and choosing reassignment, return, Copy, or move.

Read how Rust in Action: Systems programming concepts and techniques explains move →

C++ Concurrency in Action, Second Edition

Move semantics are C++ language features that allow resources to be transferred from one object to another without copying them.

How it is used
Transfers std::thread ownership when returning, passing, or reorganizing threads.
How deep it goes
Explains explicit moves from named objects, implicit moves from temporaries, and termination when assignment overwrites a thread-owning destination.
Examples
Uses ownership transfers among three std::thread objects and shows returning or passing threads.
What you can do after
Apply it via std::move to transfer named std::thread ownership without assigning over an already-associated destination.

Read how C++ Concurrency in Action, Second Edition explains move →

Idiomatic Rust

Move semantics transfer ownership of a value into a new binding or operation rather than copying the value.

How it is used
Uses ownership transfer to pass values into functions or closures, return them, and avoid borrowing or cloning.
How deep it goes
Defines moves across calls, closures, assignment, and returns, then gives practical guidance for choosing value or reference passing.
Examples
Demonstrates reversing a String by value, returning multiple results in a tuple, and consuming a captured String in a closure.
What you can do after
Apply moves to transfer non-Copy values into functions or closures, return ownership, and judge when references are preferable.

Read how Idiomatic Rust explains move →

Also covered in

What to know first

Related concepts

Questions about move

What is move?

Move semantics are language rules that transfer a value or its resources to another binding or object without copying them, potentially making the original binding unavailable.

Which Manning books explain move?

100 C++ Mistakes and How to Avoid Them, Learn Rust in a Month of Lunches, Refactoring to Rust, Rust in Action: Systems programming concepts and techniques, C++ Concurrency in Action, Second Edition and Idiomatic Rust.

What should I know before learning move?

Manning books that teach move usually introduce string, vector, borrowing and closure first.

What is the difference between move and copy?

Move semantics are language rules that transfer a value or its resources to another binding or object without copying them, potentially making the original binding unavailable. Copying is the creation of a separate representation of an existing value, object, or data, preserving some or all of its contents or state.

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.