[][src]Function glsp::write_barrier

pub fn write_barrier(rdata: &Root<RData>)

Notifies the garbage collector that an RData has been mutated.

You don't need to call this function for every mutation. It only needs to be called when the RData now owns Gc pointers which it didn't own before the mutation.

Under those circumstances, the RData must be passed to glsp::write_barrier at least once before the next call to glsp::gc.

If glsp::write_barrier is not called, then the glsp::gc call might invalidate the RData's Gc pointers, causing Gc::upgrade to return None.