Crate register_count

source ·
Expand description

register-count

Counting Registers created by a Counter

Version Documentation License

Usage

This crate helps you to count the number of currently un-dropped Registers created by a Counter.

use register_count::Counter;

let cnt = Counter::new();
println!("Number of registers: {}", cnt.count()); // 0
let reg1 = cnt.reg();
println!("Number of registers: {}", cnt.count()); // 1
let reg2 = reg1.clone();
println!("Number of registers: {}", cnt.count()); // 2
drop(reg1);
println!("Number of registers: {}", cnt.count()); // 1

no_std

Opt-out of the default features to use this crate in no_std environments.

License

MIT License

Structs

A counter that can be used to count the number of Registers referencing it.
A register.