6 releases

✓ Uses Rust 2018 edition

0.1.4 Dec 26, 2018
0.1.3 Dec 9, 2018
0.1.2 Nov 11, 2018
0.1.0 Oct 27, 2018
0.0.0 Oct 22, 2018

#284 in Data structures

Download history 11/week @ 2019-03-18 83/week @ 2019-03-25 33/week @ 2019-04-01 21/week @ 2019-04-08 15/week @ 2019-04-15 16/week @ 2019-04-22 25/week @ 2019-04-29 36/week @ 2019-05-06 26/week @ 2019-05-13 35/week @ 2019-05-20 29/week @ 2019-05-27 32/week @ 2019-06-03 7/week @ 2019-06-10 19/week @ 2019-06-17 33/week @ 2019-06-24

150 downloads per month
Used in 2 crates

GPL-3.0+

9KB
131 lines

pipeline crates.io Docs rustc

uid

uid (short for unique identifiers) is a crate for creating unique IDs for usage in a Rust program. IDs can have many purposes in programs, but this crate's IDs are mostly useful for identification tasks. For example, consider having some form of simple in-memory database (in the form of a HashMap or something more sophisticated). IDs as created by this crate make for perfect primary keys.

Said IDs have a couple properties that, depending on the context, are useful to have:

  1. IDs are lightweight and ultimately just a number with some compile time magic (and a small creation cost) attached to them.
  2. Created IDs are guaranteed to be unique. That is, when created at runtime (deserialization is not supported for obvious reasons), two newly crated IDs are guaranteed to never be the same.
  3. They are fully thread safe. That is, uniqueness is guaranteed even among different threads.
  4. IDs are immutable. Once created, an ID can be copied, hashed, compared, and more, but it cannot be changed.
  5. IDs can form name (or rather type) spaces. That is, an ID can be parametrized by an arbitrary (potentially private) type and only IDs that are parametrized by the same type can interact (i.e., be compared etc.).

No runtime deps