Function mz_ore::id_gen::temp_id

source ยท
pub fn temp_id() -> String
Expand description

Generate a random temporary ID.

Concretely we generate a UUIDv4 and return the last 12 characters for maximum uniqueness.

Note: the reason we use the last 12 characters is because the bits 6, 7, and 12 - 15 are all hard coded https://www.rfc-editor.org/rfc/rfc4122#section-4.4.

use mz_ore::id_gen::temp_id;

let temp = temp_id();
assert_eq!(temp.len(), 12);
assert!(temp.is_ascii());