Trait GarbageCollected

Source
pub trait GarbageCollected {
    // Required method
    fn get_name(&self) -> &'static CStr;

    // Provided method
    fn trace(&self, _visitor: &Visitor) { ... }
}
Expand description

Base trait for managed objects.

Required Methods§

Source

fn get_name(&self) -> &'static CStr

Specifies a name for the garbage-collected object. Such names will never be hidden, as they are explicitly specified by the user of this API.

V8 may call this function while generating a heap snapshot or at other times. If V8 is currently generating a heap snapshot (according to HeapProfiler::IsTakingSnapshot), then the returned string must stay alive until the snapshot generation has completed. Otherwise, the returned string must stay alive forever. If you need a place to store a temporary string during snapshot generation, use HeapProfiler::CopyNameForHeapSnapshot.

Provided Methods§

Source

fn trace(&self, _visitor: &Visitor)

trace should call Visitor::visit for each Member, WeakMember, or TracedReference in by the managed object.

Implementors§