Trait zerogc::CollectorId[][src]

pub unsafe trait CollectorId: Copy + Eq + Debug + NullTrace + 'static {
    type System: GcSystem<Id = Self>;
    unsafe fn gc_write_barrier<'gc, T: GcSafe + ?Sized + 'gc, V: GcSafe + ?Sized + 'gc>(
        owner: &Gc<'gc, T, Self>,
        value: &Gc<'gc, V, Self>,
        field_offset: usize
    );
unsafe fn assume_valid_system(&self) -> &Self::System; }

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]

The type of the garbage collector system

Loading content...

Required methods

unsafe fn gc_write_barrier<'gc, T: GcSafe + ?Sized + 'gc, V: GcSafe + ?Sized + 'gc>(
    owner: &Gc<'gc, T, Self>,
    value: &Gc<'gc, V, Self>,
    field_offset: usize
)
[src]

Perform a write barrier before writing to a garbage collected field

Safety

Smilar to the GcDirectBarrier trait, it can be assumed that the field offset is correct and the types match.

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

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.

Loading content...

Implementors

impl CollectorId for DummyCollectorId[src]

type System = DummySystem

Loading content...