Assigning responsibility for cleanup

Acquiring a resource creates a cleanup responsibility. Ownership associates that responsibility with program values or management objects, rather than leaving only addresses that can access the resource without a consistent release contract.

Rust’s introductory model gives each value an owner and drops the value when its owner leaves the applicable scope. For an owned String buffer, ownership and Drop behavior organize cleanup instead of requiring a handwritten release on every return path.

References: [1] [2]

Moves, copies, and borrows differ

Assigning an owned Rust String to another binding moves ownership and prevents continued use through the former binding. This does not automatically deep-copy the buffer. An explicit clone creates another owned value, with behavior and cost determined by the type.

Borrowing provides access without transferring the owner’s cleanup responsibility. Shared references and exclusive mutable references have different constraints. Access, mutation, and responsibility for release are therefore distinct permissions.

References: [1] [3]

Sharing still needs an ownership mechanism

Ownership does not forbid sharing. Rust’s Rc<T> represents multiple owners of one allocation through reference counting and cleans up the value when the strong count reaches zero. Its holders share a managed allocation rather than automatically duplicating its contents.

Rc is for single-threaded use and does not by itself permit unrestricted mutation of shared contents. Interior-mutability mechanisms such as RefCell enforce some borrowing rules dynamically. Shared ownership, thread safety, and mutation permissions still need separate explanations.

References: [4] [5]