pub unsafe trait DynTrace<'gc, Id: CollectorId> { }
Expand description

A type that can be traced via dynamic dispatch, specialized for a particular CollectorId.

This indicates that the underlying type implements both Trace and GcSafe, even though the specifics may not be known at compile time. If the type is allocated inside a Gc pointer, collectors can usually use their own runtime type information to dispatch to the correct tracing code.

This is useful for use in trait objects, because this marker type is object safe (unlike the regular Trace trait).

Safety

This type should never be implemented directly. It is automatically implemented for all types that are Trace + GcSafe.

If an object implements this trait, then it the underlying value must implement Trace and GcSafe at runtime, even though that can’t be proved at compile time.

The garbage collector will be able to use its runtime type information to find the appropriate implementation at runtime, even though its not known at compile tme.

Implementors