Expand description
Trace implementations for GC-rooted types defined in this crate. Types
in lua-types (LuaValue, LuaString, UpVal) have their Trace impls in
lua-types/src/trace_impls.rs because of Rust’s orphan rule.
Guidance for adding a new impl (Trace impls have subtle invariants, so change one type at a time):
- Read the type definition; enumerate every field
- For every
Gc<T>,GcRef<T>, or container (Vec/Option/HashMap) thereof, callm.mark(field)orfield.trace(m)appropriately - Skip non-GC fields (primitives,
String,Vec<u8>) - Skip “intentionally not traced” fields (weak refs)
- Reference
lgc.c’sreallymarkobjectfor the C original’s approach