puid

Crates.iopuid
lib.rspuid
version0.1.2
created_at2025-05-28 19:19:25.46722+00
updated_at2025-06-17 00:04:08.000523+00
descriptionA library for generating and parsing PUIDs (Prefixed Unique Identifiers).
homepage
repositoryhttps://github.com/mrvillage/puid
max_upload_size
id1693169
size60,145
Josef (mrvillage)

documentation

README

Prefixed Unique Identifier (PUID) Generator

Overview

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.

Usage

puid::puid!(UserId = "usr");

fn main() {
    let user_id = UserId::new();
    println!("Generated User ID: {}", user_id); // e.g., usr_45A0IQarTgXyiRM6VQ9YbX
}
Commit count: 10

cargo fmt