Finalization

Struct Finalization 

Source
pub struct Finalization<'gc> { /* private fields */ }
Expand description

Handle value given to finalization callbacks in MarkedArena.

Derefs to Mutation<'gc> to allow for arbitrary mutation, but adds additional powers to examine the state of the fully marked arena.

Methods from Deref<Target = Mutation<'gc>>§

Source

pub fn metrics(&self) -> &Metrics

Source

pub fn backward_barrier(&self, parent: Gc<'gc, ()>, child: Option<Gc<'gc, ()>>)

IF we are in the marking phase AND the parent pointer is colored black AND the child (if given) is colored white, then change the parent color to gray and enqueue it for tracing.

This operation is known as a “backwards write barrier”. Calling this method is one of the safe ways for the value in the parent pointer to use internal mutability to adopt the child pointer without invalidating the color invariant.

If the child parameter is given, then calling this method ensures that the parent pointer may safely adopt the child pointer. If no child is given, then calling this method is more general, and it ensures that the parent pointer may adopt any child pointer(s) before collection is next triggered.

Source

pub fn forward_barrier(&self, parent: Option<Gc<'gc, ()>>, child: Gc<'gc, ()>)

IF we are in the marking phase AND the parent pointer (if given) is colored black, AND the child is colored white, then immediately change the child to gray and enqueue it for tracing.

This operation is known as a “forwards write barrier”. Calling this method is one of the safe ways for the value in the parent pointer to use internal mutability to adopt the child pointer without invalidating the color invariant.

If the parent parameter is given, then calling this method ensures that the parent pointer may safely adopt the child pointer. If no parent is given, then calling this method is more general, and it ensures that the child pointer may be adopted by any parent pointer(s) before collection is next triggered.

Trait Implementations§

Source§

impl<'gc> Deref for Finalization<'gc>

Source§

type Target = Mutation<'gc>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<'gc> !Freeze for Finalization<'gc>

§

impl<'gc> !RefUnwindSafe for Finalization<'gc>

§

impl<'gc> !Send for Finalization<'gc>

§

impl<'gc> !Sync for Finalization<'gc>

§

impl<'gc> Unpin for Finalization<'gc>

§

impl<'gc> !UnwindSafe for Finalization<'gc>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.