rune::core::gc

Module root

Source

Structs§

  • ObjectMap 🔒
    A HashMap that can hold values past garbage collection.
  • A “Root Tracable” type. If a type is wrapped in Rt, it is known to be rooted and hold items past garbage collection. This type is never used as an owned type, only a reference. This ensures that underlying data does not move. In order to access the inner data, use Rt::bind_ref or Rt::bind_mut methods.
  • A moveable pointer to the GC heap. This is used to wrap Rooted Object’s so that we don’t trigger UB when moving types during collection.

Traits§

  • IntoRoot 🔒
    Helper trait to break the dependency between an object and the lifetimes of it’s traceable children. If This trait is implemented, than the object can be traced by the garbage collector. Once it becomes rooted, it as well as all of it’s tracable children will be live until it is unrooted. This essentially makes any lifetimes of a tracable objects meaningless. They can be anything, including ’static. When an object is removed from a root it will be given the proper lifetime again. Care must be taken to ensure that any lifetimes that are changed only belong to traceable objects. Object can contain lifetimes parameters for both traceable and untracable children, and only the traceable children’s lifetimes can be changed.
  • Trait created to overpass the orphan rule when deriving the Trace derive macro. The derive macro contains a blanket Deref (and DerefMut) like this:

Type Aliases§

  • A “Root Tracable Object”. This differs from Rt by wrapping a Slot which allows the underlying data to be moved during garbage collection. GC owned types will always be wrapped in a Slot when rooted. To access the object, use Rto::bind.