]>
Commit | Line | Data |
---|---|---|
064997fb FG |
1 | A library to quickly get the live/total/max counts of allocated instances. |
2 | ||
3 | ```rust | |
4 | #[derive(Default)] | |
5 | struct Widget { | |
6 | _c: countme::Count<Self>, | |
7 | ... | |
8 | } | |
9 | ||
10 | let w1 = Widget::default(); | |
11 | let w2 = Widget::default(); | |
12 | let w3 = Widget::default(); | |
13 | drop(w1); | |
14 | ||
15 | let counts = countme::get::<Widget>(); | |
16 | assert_eq!(counts.live, 2); | |
17 | assert_eq!(counts.max_live, 3); | |
18 | assert_eq!(counts.total, 3); | |
19 | ||
20 | eprintln!("{}", countme::get_all()); | |
21 | ``` |