Crate tinyid

source ·
Expand description

tinyid

A tiny ID type that is definitely not cryptographically secure, but is easier for a user to see and type in, while still being unique enough to create at least 1-10 million instances without collision. It is also very efficiently stored, essentially taking up as much size as a u64.

Example Usage

use tinyid::TinyId;

let mut id = TinyId::random();
assert!(id.is_valid());
assert!(!id.is_null());
id.make_null();
assert!(!id.is_valid());
assert!(id.is_null());
assert_eq!(id, TinyId::null());

Structs

A tiny 8-byte ID type that is NOT cryptographically secure, but is easy and convenient for tasks that don’t require the utmost security or uniqueness. During lightweight testing, between 1 and 10 million IDs can be generated without any collisions, and performance has been pretty good.

Enums

Error type used by TinyId operations that are fallible.