Semua buku

Profesional

Aplikasi Tentang Pelatih Masuk Mulai membaca

Computer Science · Glosarium

Apa itu Borrow?

Dikenal juga sebagai: borrow (Rust)

Definition 6.5 University Computer Science — Year 2 · Bab 6 — Rust: Ownership and Borrowing

A borrow is a reference to a value that does not take ownership of it. A shared borrow &x, of type &T, allows reading the value; a mutable, or exclusive, borrow &mut x, of type &mut T, allows changing it. The borrowing rule: at any point of the program, a value has either any number of shared borrows in use, or exactly one exclusive borrow in use, but not both; and no borrow is used after the value is moved or dropped.

Baca dalam konteks →