Todos os livros

Profissional

Apps Sobre Coach Entrar Começar a ler

Computer Science · Glossário

O que é Borrow?

Também chamado de: borrow (Rust)

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

Ler no capítulo →