Derive Macro type_census::Tabulate
source · [−]#[derive(Tabulate)]
{
// Attributes available to this derive:
#[Tabulate]
}
Expand description
Automatically derive the implementation of Tabulate
.
By default, this uses counter::RelaxedCounter
to count the instances.
You can use a different counter type like so:
// 1. import these two items:
use type_census::{Instance, Tabulate};
// 2. Derive `Tabulate`
// This will count instances with a `DistributedCounter` with 32 buckets.
#[derive(Clone, Tabulate)]
#[Tabulate(Counter = "type_census::counter::DistributedCounter<32>")]
pub struct Foo<T> {
v: T,
// 3. add a field of type `Instance<Self>`
_instance: Instance<Self>,
}