#ownership Clear
Tags #php #kotlin #bash #go #sql #rust #typescript #html #java #python #files #utils #strings #http #concurrency #async #json #arrays #security #types #crypto #database #dates #format
Rust Move vs Borrow — the Core Rule
Rust's ownership model: passing a value transfers ownership (move); taking a `&value` lets you read without taking ownership; `&mut value` lets you modify without taking ownership. Only one mutable borrow OR many immutable borrows at a time.
Rust Rc and Arc — Shared Ownership
`Rc<T>` lets multiple owners share read-only access in single-threaded code; `Arc<T>` is the thread-safe version. Pair with `RefCell` / `Mutex` when you need shared MUTABLE access.
Rust Clone vs Copy — When to Use Each
Stack-allocated primitives implement `Copy` (auto-duplicated). Heap-owning types like `String` and `Vec` only implement `Clone` (you must explicitly call `.clone()` to opt into the deep copy cost).