ownership

Rust Ownership: who manages a value?

Ownership is Rust’s way of tracking responsibility for values. A binding can own a value, and that responsibility can be transferred. When an owned value reaches its drop point, Rust normally cleans it up. Start with an owned String, then learn shared ownership separately. Expected output (not executed): Ticket: A12 Why: ticket owns the String; formatting reads it without consuming it. Common mistake: Thinking ownership means every value has exactly one possible reference. Borrowing and shared-ownership types allow multiple forms of access.

Formal Syntax & Structure

rust syntaxrust
let owner = value;

Working Example

Example Snippetrust
fn main() {    let ticket = String::from("A12");    println!("Ticket: {ticket}");}
Rust Reference