Trait zerogc::CollectorId[][src]

pub unsafe trait CollectorId: Copy + Eq + Debug + NullTrace + 'static {
    type System: GcSystem<Id = Self>;
    unsafe fn assume_valid_system(&self) -> &Self::System;
}
Expand description

Uniquely identifies the collector in case there are multiple collectors.

Safety

To simply the typing, this contains no references to the lifetime of the associated GcSystem.

It’s implicitly held and is unsafe to access. As long as the collector is valid, this id should be too.

It should be safe to assume that a collector exists if any of its pointers still do!

Associated Types

type System: GcSystem<Id = Self>[src]

Expand description

The type of the garbage collector system

Required methods

unsafe fn assume_valid_system(&self) -> &Self::System[src]

Expand description

Assume the ID is valid and use it to access the GcSystem

NOTE: The system is bound to the lifetime of THIS id. A CollectorId may have an internal pointer to the system and the pointer may not have a stable address. In other words, it may be difficult to reliably take a pointer to a pointer.

Safety

Undefined behavior if the associated collector no longer exists.

Implementors