kyren / gc-arena

Incremental garbage collection from safe Rust
Creative Commons Zero v1.0 Universal
436 stars 36 forks source link

Expose inner `GcRefCell` as `CollectRefCell` and also add `CollectCell` #56

Closed kyren closed 1 year ago

kyren commented 1 year ago

These types are generally useful, even if they require unsafe to be useful.

It's nice to not have to manually make an unsafe Collect impl, rather than only having to remember to trigger a write barrier.

kyren commented 1 year ago

If anyone has better names than CollectRefCell and CollectCell I'm all ears.

moulins commented 1 year ago

Instead of having a separate method for each unsafe operation on each cell type, I'd propose just providing a single method:

unsafe fn as_(ref_)cell(&self) -> &(Ref)Cell<T>;

This is slightly more verbose to use, but IMHO, it has two advantages:


If anyone has better names than CollectRefCell and CollectCell I'm all ears.

Some suggestions: