rune::core::gc::root

Trait IntoRoot

Source
pub(crate) trait IntoRoot<T> {
    // Required method
    unsafe fn into_root(self) -> T;
}
Expand description

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.

On top of scrubbing the lifetimes, this trait can also do a transformation of the underlying type for convenience, similar to calling Into::into.

Required Methods§

Source

unsafe fn into_root(self) -> T

Implementations on Foreign Types§

Source§

impl<'a> IntoRoot<Slot<Gc<ObjectType<'a>>>> for bool

Source§

unsafe fn into_root(self) -> Slot<Gc<ObjectType<'a>>>

Source§

impl<'a> IntoRoot<Slot<Gc<ObjectType<'a>>>> for i64

Source§

unsafe fn into_root(self) -> Slot<Gc<ObjectType<'a>>>

Source§

impl<T, U> IntoRoot<Option<U>> for Option<T>
where T: IntoRoot<U>,

Source§

unsafe fn into_root(self) -> Option<U>

Source§

impl<T, U> IntoRoot<Vec<U>> for Vec<T>
where T: IntoRoot<U>,

Source§

unsafe fn into_root(self) -> Vec<U>

Source§

impl<T, U, Tx, Ux> IntoRoot<(Tx, Ux)> for (T, U)
where T: IntoRoot<Tx>, U: IntoRoot<Ux>,

Source§

unsafe fn into_root(self) -> (Tx, Ux)

Implementors§

Source§

impl<'a, T, U> IntoRoot<Slot<U>> for &Rt<Slot<T>>
where T: WithLifetime<'a, Out = U> + Copy,

Source§

impl<'brw, 'env> IntoRoot<VM<'brw, 'env, 'static>> for VM<'brw, 'env, '_>

Source§

impl<'new> IntoRoot<Handler<'new>> for Handler<'_>

Source§

impl<'new> IntoRoot<FrameStore<'new>> for FrameStore<'_>

Source§

impl<'new, T, U> IntoRoot<Slot<U>> for T
where T: WithLifetime<'new, Out = U> + GcPtr,