2 stable releases
Uses new Rust 2024
new 1.0.1 | Apr 18, 2025 |
---|
#179 in Science
160 downloads per month
7KB
56 lines
UTally
This tool was created to allow easily creating unique ids for types in both static and dynamic contexts. The ids are sequential, this is basically a tally counter.
Usage
Call [next] to acquire a new unique id.
let unique_id = utally::next();
Using it in a static context
You can use [LazyTally] in order to assign ids to types or functions by using them in static contexts:
pub fn function_with_unique_id() -> usize {
static SOME_TALLY: LazyTally = LazyTally::new();
SOME_TALLY.get()
}
A call to function_with_unique_id
would always return the same unique id.
UTally
This tool was created to allow easily creating unique ids for types in both static and dynamic contexts. The ids are sequential, this is basically a tally counter.
Usage
Call [next] to acquire a new unique id.
let unique_id = utally::next();
Using it in a static context
You can use [LazyTally] in order to assign ids to types or functions by using them in static contexts:
# use utally::*;
pub fn function_with_unique_id() -> usize {
static SOME_TALLY: LazyTally = LazyTally::new();
SOME_TALLY.get()
}
A call to function_with_unique_id
would always return the same unique id.