Derive Macro Trace

Source
#[derive(Trace)]
{
    // Attributes available to this derive:
    #[trace]
}
Available on crate feature proc_macro only.
Expand description

Proc macro for deriving Trace. By default, this will call Trace::visit_children on all members of the type.

  • If you wish to only visit specific members, you may annotate them with #[trace], and only those members will be traced (other fields will be ignored).
  • If you wish to ignore a specific field, you may annote it with #[trace(ignore)].

ยงExamples

  • Default:
#[derive(Trace)]
struct MyType {
    default_traced_1: Gc<u64>,
    default_traced_2: Gc<u64>,
}
  • Tracing specific fields:
#[derive(Trace)]
struct MyType {
    #[trace]
    gc_field: Gc<u64>,

    default_ignored: i64,
}
  • Ignoring specific fields:
#[derive(Trace)]
struct MyType {
    default_traced: Gc<u64>,

    #[trace(ignore)]
    ignored: i64,
}