Trait scoped_gc::Trace [] [src]

pub unsafe trait Trace {
    unsafe fn mark(&self);
unsafe fn root(&self);
unsafe fn unroot(&self); }

Used to propagate signals across the objects graph of values managed by the garbage collector.

This trait is unsafe because an invalid implementations may cause dangling pointers. For example, if trace is not propagated to a reachable Gc pointers then its value may be freed. The next dereference of this Gc causes then an error.

You should never initiate the traversal of the object graph: it is the role of the library. Propagating a signal at the wrong time may cause an invalid state leading to dangling pointers.

Required Methods

Propagates the mark signal across the objects graph.

This signal is used during the first phase of garbage collection to mark the values that are still reachable.

The signal is initiated at the rooted values and propagated to reach the adjacent Gc pointers. If their value is not already marked they mark it and propagate the signal further in the graph.

Propagates the root signal across the objects graph.

This signal is used to signal that there is a new root pointing to a managed value. This prevents this value (and any other value reachable from it) from being collected.

This is initiated when creating a new Gc pointer or mutably borrowing the value inside a GcRefCell.

Propagates the unroot signal across the objects graph.

This signal is used to signal the destruction of a root pointing to a managed value. If this was the last root, the value is not longer used to initiate mark signals: if there are no other rooted values that can reach it, it becomes eligible for garbage collection.

This is initiated when a Gc pointer or mutably borrowing the value inside a GcRefCell.

Implementations on Foreign Types

impl Trace for ()
[src]

[src]

[src]

[src]

impl Trace for u8
[src]

[src]

[src]

[src]

impl Trace for u16
[src]

[src]

[src]

[src]

impl Trace for u32
[src]

[src]

[src]

[src]

impl Trace for u64
[src]

[src]

[src]

[src]

impl Trace for usize
[src]

[src]

[src]

[src]

impl Trace for i8
[src]

[src]

[src]

[src]

impl Trace for i16
[src]

[src]

[src]

[src]

impl Trace for i32
[src]

[src]

[src]

[src]

impl Trace for i64
[src]

[src]

[src]

[src]

impl Trace for isize
[src]

[src]

[src]

[src]

impl Trace for f32
[src]

[src]

[src]

[src]

impl Trace for f64
[src]

[src]

[src]

[src]

impl Trace for char
[src]

[src]

[src]

[src]

impl Trace for String
[src]

[src]

[src]

[src]

impl Trace for Path
[src]

[src]

[src]

[src]

impl Trace for PathBuf
[src]

[src]

[src]

[src]

impl Trace for AtomicBool
[src]

[src]

[src]

[src]

impl Trace for AtomicIsize
[src]

[src]

[src]

[src]

impl Trace for AtomicUsize
[src]

[src]

[src]

[src]

impl<T: Trace> Trace for Box<T>
[src]

[src]

[src]

[src]

impl<T: Trace> Trace for Option<T>
[src]

[src]

[src]

[src]

impl<T: Trace, E: Trace> Trace for Result<T, E>
[src]

[src]

[src]

[src]

impl<T: Trace> Trace for Vec<T>
[src]

[src]

[src]

[src]

impl<K: Eq + Hash + Trace, V: Trace> Trace for HashMap<K, V>
[src]

[src]

[src]

[src]

Implementors