pub fn cuid1() -> Result<String, CuidError>Expand description
Generate a v1 CUID
A CUID is composed of:
- The letter
c - The timestamp in milliseconds as a base 36 number
- An atomic counter that goes from 0 through 36^4 and then repeats, as a base 36 number
- A (base 36) fingerprint derived from the system’s hostname
- Two random numbers between 0 and 36^4, each converted to base 36
§Examples
extern crate cuid;
let id = cuid::cuid();
assert!(cuid::is_cuid(id.unwrap()));