Crate hv_lease_tracker

Crate hv_lease_tracker 

Source
Expand description

Heavy Lease Tracker - functionality for tracking borrows and providing more helpful errors on runtime borrowing/aliasing violations.

  • LeaseTracker type, for use in smart cells like hv-cell’s AtomicRefCell (only on debug with track-leases feature enabled)
  • Lease type, for use in smart references/guard types like hv-cell’s AtomicRef/AtomicRefMut and ArcRef/ArcRefMut
  • OpenLease type, representing the origin of a dynamic borrow for diagnostic usage

no_std compatible, but requires alloc for Arcs, Cows, and Strings and uses spinlocks internally to LeaseTracker for synchronizing adding/removing OpenLeases.

hv-lease-tracker is not a super performant crate, and should probably be disabled in your release builds if performance of borrows is critical. It is strictly for diagnostic info.

Structs§

Lease
A handle to an OpenLease. Created from a LeaseTracker, and carries an index pointing to debug information about that lease inside its tracker. This type is a drop guard and should be kept in your smart reference/guard type; when dropped, it removes its associated lease from its tracker.
LeaseTracker
A registry which tracks the origins of dynamic borrows to provide better debug information on a borrow error.
OpenLease
An OpenLease represents the origin of an ongoing dynamic borrow. Stored as an entry for a Lease inside a LeaseTracker.