pub type PluginTraverseFn = extern "C" fn(opaque_ptr: *mut c_void, visit: PluginVisitFn, visit_ctx: *mut c_void) -> i32;Expand description
Per-class GC traversal callback, declared on ClassDesc::traverse.
Called by the host’s GC during the mark phase, once per live plugin-backed
instance. The plugin must call visit(visit_ctx, v) for every
GenericValue its opaque struct references; failure to report a held
value is a use-after-free bug (the collector is mark-and-sweep, so a value
that is never reported is swept even though it is still reachable).
Returns 0 on success; a non-zero return is reserved and currently ignored.
§Safety
opaque_ptr is the pointer installed via instance_set_opaque, or null if
__init__ has not run yet - the plugin must handle null gracefully. The
host already traces the instance’s generic fields, so the plugin reports
only the values held in its own opaque state. visit and visit_ctx are
the host-provided marking function and its context; pass them through to
visit unchanged.