ownership
Rust Move semantics: transfer ownership
Evaluating an owned non-Copy value in a moving context transfers responsibility to the destination. The source binding cannot be read until it is validly initialized again. This is a semantic rule, not a promise that heap bytes are relocated. Expected output (not executed): Submitted: Report Why: submitted owns the original string; the source is moved from. Common mistake: Trying to print draft after assigning it to submitted.
Formal Syntax & Structure
rust syntaxrust
let destination = source;Working Example
Example Snippetrust
fn main() { let draft = String::from("Report"); let submitted = draft; println!("Submitted: {submitted}");}