Expand description
Helpers for reference counting
Two main purposes:
- Consistent handling of overflow and underflow
- Assurance of incrementing/decrementing as appropriate, including in combination with a slotmap containing the referenced data.
The caller is responsible for making sure that the right instance’s
Count
is passed to the methods on Ref
.
Macros§
- slotmap_
dec_ 🔒ref - Decrement a refcount and maybe remove a corresponding slotmap entry
Structs§
- Count 🔒
- A reference count, counting references with id type
K
- Garbage 🔒
- Something which has become garbage
- Overflow 🔒
- Error: refcount overflowed
- Ref 🔒
- An copy of a
slotmap_careful::Key
K
, which is counted by aRefCount
Functions§
- dec_raw 🔒
- Decrement this refcount, but don’t care about any
Ref
s - inc_raw 🔒
- Increment this refcount, but don’t care about any
Ref
s - slotmap_
insert 🔒 - Insert a new entry into a slotmap using refcounted keys
- slotmap_
remove_ 🔒early - Unconditionally remove en entry from the slotmap, given a strong ref
- slotmap_
try_ 🔒insert - Insert a new entry into a slotmap using refcounted keys, fallibly and with extra data
Type Aliases§
- RawCount 🔒
- Local alias for the counter type