You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An immutable reference to a RefCell’s inner value (&T) can be obtained with borrow, and a mutable borrow (&mut T) can be obtained with borrow_mut. When these functions are called, they first verify that Rust’s borrow rules will be satisfied: any number of *immutable* borrows are allowed or a *single immutable* borrow is allowed, but never both. If a borrow is attempted that would violate these rules, the thread will panic.
Summary
any number of immutable borrows are allowed or a single mutable (immutable -> mutable) borrow is allowed, but never both
The text was updated successfully, but these errors were encountered:
ghost
added
the
A-docs
Area: Documentation for any part of the project, including the compiler, standard library, and tools
label
Aug 6, 2023
Location
https://doc.rust-lang.org/std/cell/index.html#refcellt
An immutable reference to a
RefCell
’s inner value (&T
) can be obtained with borrow, and a mutable borrow (&mut T
) can be obtained withborrow_mut
. When these functions are called, they first verify that Rust’s borrow rules will be satisfied: any number of *immutable* borrows are allowed or a *single immutable* borrow is allowed, but never both. If a borrow is attempted that would violate these rules, the thread will panic.Summary
any number of immutable borrows are allowed or a single mutable (
immutable -> mutable
) borrow is allowed, but never bothThe text was updated successfully, but these errors were encountered: