Crates.io | puid |
lib.rs | puid |
version | 0.1.2 |
created_at | 2025-05-28 19:19:25.46722+00 |
updated_at | 2025-06-17 00:04:08.000523+00 |
description | A library for generating and parsing PUIDs (Prefixed Unique Identifiers). |
homepage | |
repository | https://github.com/mrvillage/puid |
max_upload_size | |
id | 1693169 |
size | 60,145 |
This project generates prefixed IDs that can be used as unique identifiers in various applications. Inspired by Stripe, it allows for the creation of type-safe IDs with a specific prefix and a randomly generated 22 character suffix composed of a base62 encoded 128 bit random number.
puid::puid!(UserId = "usr");
fn main() {
let user_id = UserId::new();
println!("Generated User ID: {}", user_id); // e.g., usr_45A0IQarTgXyiRM6VQ9YbX
}