]> git.proxmox.com Git - rustc.git/blame - vendor/countme/README.md
New upstream version 1.64.0+dfsg1
[rustc.git] / vendor / countme / README.md
CommitLineData
064997fb
FG
1A library to quickly get the live/total/max counts of allocated instances.
2
3```rust
4#[derive(Default)]
5struct Widget {
6 _c: countme::Count<Self>,
7 ...
8}
9
10let w1 = Widget::default();
11let w2 = Widget::default();
12let w3 = Widget::default();
13drop(w1);
14
15let counts = countme::get::<Widget>();
16assert_eq!(counts.live, 2);
17assert_eq!(counts.max_live, 3);
18assert_eq!(counts.total, 3);
19
20eprintln!("{}", countme::get_all());
21```