Function cuid::cuid

source ·
pub fn cuid() -> Result<String, CuidError>
👎Deprecated since 1.3.0: cuid() is deprecated. Use cuid2() instead, or switch to the cuid2 crate. See https://github.com/paralleldrive/cuid2#improvements-over-cuid for more information
Expand description

Generate a 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()));