Alle boeken

Professioneel

Apps Over Coach Inloggen Begin met lezen

Computer Science · Begrippenlijst

Wat is Borrow?

Ook bekend als: borrow (Rust)

Definition 6.5 University Computer Science — Year 2 · Hoofdstuk 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.

Lees in het hoofdstuk →