Todos los libros

Profesional

Apps Acerca de Coach Iniciar sesión Empezar a leer

Computer Science · Glosario

¿Qué es Move?

También llamado: move (Rust)

Definition 6.3 University Computer Science — Year 2 · Capítulo 6 — Rust: Ownership and Borrowing

A move transfers ownership of a value: an assignment let b = a;, the passing of a as an argument by value, or its return from a function copies the bytes of a’s stack part to the destination, which becomes the owner. The source is then moved from: the compiler refuses any later use of it, and does not drop it.

A move of a String. The three words of a are copied into b; the buffer stays where it is, with one owner, b. The compiler forbids any use of a afterwards and drops only b, so the buffer is freed exactly once. In C++, a move would also have emptied a, and run its destructor later; in Rust nothing runs on a at all.
A move of a String. The three words of a are copied into b; the buffer stays where it is, with one owner, b. The compiler forbids any use of a afterwards and drops only b, so the buffer is freed exactly once. In C++, a move would also have emptied a, and run its destructor later; in Rust nothing runs on a at all.
Leer en el capítulo →