GcTrace

Trait GcTrace 

Source
pub unsafe trait GcTrace {
    // Required method
    fn trace(&self);

    // Provided methods
    fn size_hint(&self) -> usize { ... }
    fn cleanup(&self) { ... }
}
Expand description

Trait required for all GC’d data. Unsafe because if the trace() implementation fails to call Gc::mark_trace() and GcWeak::mark_trace() on all of the Gc and GcWeak pointers that it can reach, the GC will free memory that is still in use. SAFETY: If the receiver also impls Drop, the drop() impl must not deref any Gc or GcWeak pointers

Required Methods§

Source

fn trace(&self)

SAFETY: Must call Gc::mark_trace() on every reachable Gc handle

Provided Methods§

Source

fn size_hint(&self) -> usize

If the GcTrace owns any allocations, this should return the extra allocated size. If the allocation can change size, like a Vec, then don’t include it in the size hint, or return a const estimate of the average size.

Source

fn cleanup(&self)

Implementations on Foreign Types§

Source§

impl GcTrace for str

Source§

fn trace(&self)

Source§

fn size_hint(&self) -> usize

Source§

impl<T> GcTrace for [T]
where T: GcTrace,

Source§

fn trace(&self)

Source§

fn size_hint(&self) -> usize

Source§

impl<T> GcTrace for Cell<T>
where T: GcTrace + Copy,

Source§

fn trace(&self)

Source§

fn size_hint(&self) -> usize

Source§

impl<T> GcTrace for RefCell<T>
where T: GcTrace,

Source§

fn trace(&self)

Source§

fn size_hint(&self) -> usize

Implementors§