utally 1.0.1

Unique ids in static contexts
Documentation
  • Coverage
  • 100%
    11 out of 11 items documented1 out of 10 items with examples
  • Size
  • Source code size: 17.16 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.49 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • trindadegm

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.