Crate cuid

Source
Expand description

§cuid-rust

CUID generation in rust

use cuid;

// Get a v1 CUID
println!("{}", cuid::cuid1().unwrap());

// Get a v2 CUID
println!("{}", cuid::cuid2());

Note that this crate also provides a very simple, single purpose commandline interface:

$> cuid
ckfritrvg0000kdtwc766fful

You can generate v2 CUIDs via the commandline like so:

$> cuid --v2

See the original v1 implementation and original v2 implementation for more details on CUIDs in general.

Structs§

Cuid2Constructor
Provides customization of CUID generation.

Enums§

CuidError
Errors for the CUID library

Functions§

cuidDeprecated
Generate a CUID
cuid1
Generate a v1 CUID
cuid2
Creates a new CUID.
cuid1_slug
Generate a CUID v1 slug
cuid2_slug
Creates a new CUID slug, which is just a CUID with a length of 10 characters.
is_cuidDeprecated
Return whether a string is a legitimate CUID
is_cuid1
Return whether a string looks like it could be a legitimate CUID
is_cuid2
Return whether a string is a legitimate CUID2
is_cuid1_slug
Return whether a string looks like it could be a legitimate v1 CUID slug
is_cuid2_slug
Return whether a string looks like it could be a legitimate CUID slug.
is_slugDeprecated
Return whether a string looks like it could be a legitimate CUID slug
slugDeprecated
Generate a CUID slug