liveBook · Manning

Move

Move semantics describe the transfer of a value or its resources to another binding or object rather than duplicating them.

How 5 Manning books explain it

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 why passing a String prevents reuse of its binding and why a thread closure may need to take values by ownership.
How deep it goes
Walks through a failed function call and its compiler error, then applies move to closures without detailing memory-layout internals.
Examples
Uses a String passed twice to a function, an i32 passed twice, and a spawned closure that prints a String.
What you can do after
Diagnose/debug with compiler move errors, then choose borrowing, cloning, or a move closure when the example calls for it.

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 →

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.