pub trait PolicyTraceObject<VM: VMBinding> {
// Required methods
fn trace_object<Q: ObjectQueue, const KIND: u8>(
&self,
queue: &mut Q,
object: ObjectReference,
copy: Option<CopySemantics>,
worker: &mut GCWorker<VM>,
) -> ObjectReference;
fn may_move_objects<const KIND: u8>() -> bool;
// Provided method
fn post_scan_object(&self, _object: ObjectReference) { ... }
}Expand description
This trait defines policy-specific behavior for tracing objects.
The procedural macro #[derive(PlanTraceObject)] will generate code
that uses this trait. We expect any policy to implement this trait.
For the sake of performance, the implementation
of this trait should mark methods as [inline(always)].
Required Methods§
Sourcefn trace_object<Q: ObjectQueue, const KIND: u8>(
&self,
queue: &mut Q,
object: ObjectReference,
copy: Option<CopySemantics>,
worker: &mut GCWorker<VM>,
) -> ObjectReference
fn trace_object<Q: ObjectQueue, const KIND: u8>( &self, queue: &mut Q, object: ObjectReference, copy: Option<CopySemantics>, worker: &mut GCWorker<VM>, ) -> ObjectReference
Trace object in the policy. If the policy copies objects, we should
expect copy to be a Some value.
Sourcefn may_move_objects<const KIND: u8>() -> bool
fn may_move_objects<const KIND: u8>() -> bool
Return whether the policy moves objects.
Provided Methods§
Sourcefn post_scan_object(&self, _object: ObjectReference)
fn post_scan_object(&self, _object: ObjectReference)
Policy-specific post-scan-object hook. It is called after scanning each object in this space.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.