#identifier #unique-identifier #human-readable #generate #uuid #name #alliterative

bin+lib individual-identifiers

A library for creating unique, human-readable alliterative identifiers

3 releases

0.1.2 Aug 4, 2023
0.1.1 Aug 4, 2023
0.1.0 Aug 4, 2023

#47 in #unique-identifier

Download history 6/week @ 2024-02-19 30/week @ 2024-02-26 13/week @ 2024-03-11 51/week @ 2024-04-01

64 downloads per month

MIT license

14KB
214 lines

individual-identifiers

individual-identifiers is a Rust library that generates unique identifiers, each consisting of a UUID and a name. The names are alliterative phrases generated by fetching words from the Datamuse API.

Usage

First, add the following to your Cargo.toml:

```toml [dependencies] individual-identifiers = "0.1.0" ```

Then, in your Rust file:

```rust use individual_identifiers::Identifier;

let mut id = Identifier::new(); id.set(); println!("{}", id); ```

The Identifier struct has three possible states:

  • Default: The initial state when an Identifier is created. The Identifier has a UUID but no name.
  • Success: The state when a name has been successfully generated for the Identifier. The Identifier has both a UUID and a name.
  • Failure: The state when an error occurs while generating a name for the Identifier. The Identifier has a UUID and an error message.

Testing

This library includes a test for uniqueness, which creates a large number of Identifiers and checks for repeated words and combinations. It uses a multi-threaded approach to generate the Identifiers in parallel, with the number of threads being twice the number of logical cores on your machine.

Contributing

Pull requests are welcome.

License

This project is licensed under the MIT License.

Dependencies

~4–18MB
~263K SLoC