utally

Crates.ioutally
lib.rsutally
version1.0.1
created_at2025-04-18 13:22:02.594892+00
updated_at2025-04-18 13:25:27.173697+00
descriptionUnique ids in static contexts
homepage
repository
max_upload_size
id1639447
size17,643
Gustavo M. Trindade (trindadegm)

documentation

README

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.

Commit count: 0

cargo fmt