Skip to main content

Module borrow

Module borrow 

Source
Expand description

Deterministic borrow guards for account data.

Ref and RefMut provide RAII borrow tracking on the borrow_state field of RuntimeAccount. When dropped, they restore the borrow state, preventing use-after-free and double-mutable-borrow bugs.

These replace core::cell::RefCell without requiring alloc.

Structsยง

Ref
Shared (immutable) borrow guard for account data.
RefMut
Exclusive (mutable) borrow guard for account data.