Crates.io | individual-identifiers |
lib.rs | individual-identifiers |
version | 0.1.2 |
source | src |
created_at | 2023-08-04 16:46:16.664418 |
updated_at | 2023-08-04 17:03:37.015241 |
description | A library for creating unique, human-readable alliterative identifiers. |
homepage | |
repository | https://github.com/kirkl4nd/individual-identifiers |
max_upload_size | |
id | 935427 |
size | 45,984 |
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.
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.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.
Pull requests are welcome.
This project is licensed under the MIT License.