Trait tiptoe::IntrusivelyCountable [−][src]
pub unsafe trait IntrusivelyCountable {
type RefCounter: RefCounter;
fn ref_counter(&self) -> &Self::RefCounter;
}
Expand description
Enables intrusive reference counting for a structure.
Safety
The returned TipToe
must point to an instance embedded inside Self
or semantically equivalent.
If the TipToe
is embedded, then Self
must be !Unpin
!
Hint:
TipToe
is!Unpin
.
The
TipToe
also mustn’t be otherwise decremented (which can only be guaranteed if it’s not public) in violation of sound reference-counting, but that’sunsafe
anyway.
IntrusivelyCountable::ref_counter
must not have any effects, that is: It must not affect or effect any observable changes, other than through its return value.
Mainly so the callee doesn’t observe its address, which gives this crate a bit more flexibility regarding implementation details.
Associated Types
type RefCounter: RefCounter
type RefCounter: RefCounter
Required methods
fn ref_counter(&self) -> &Self::RefCounter
fn ref_counter(&self) -> &Self::RefCounter
Gets a reference to the instance’s reference counter.
I highly recommend inlining this.