Skip to main content

Module refs

Module refs 

Source
Expand description

Lifetime-scoped reference newtypes for values held in the platform cache.

Each reference type wraps a std::cell::Ref or std::cell::RefMut borrow into a cached cell, hiding the smart-pointer leak from public Cache accessor signatures and providing ergonomic trait impls (Deref, PartialEq against the inner value, Display, Debug).

The borrow drops with the enclosing scope, which makes any attempt to hold it across a cache mutation panic at runtime: a loud failure beats the silent staleness that a stored clone would produce. Use the corresponding *_owned accessor on Cache when an owned snapshot is needed for a boundary handover.

Structsยง

AccountRef
Lifetime-scoped read borrow of a cached account.
AccountRefMut
Lifetime-scoped exclusive write borrow of a cached account.
OrderRef
Lifetime-scoped read borrow of a cached order.
OrderRefMut
Lifetime-scoped exclusive write borrow of a cached order.
PositionRef
Lifetime-scoped read borrow of a cached position.
PositionRefMut
Lifetime-scoped exclusive write borrow of a cached position.