dsntk_common/idents.rs
1//! # Random UUID generator
2
3use uuid::Uuid;
4
5/// Returns a string representation of a random UUID v4.
6///
7/// # Example
8///
9/// The string should be 36 characters long.
10///
11/// ```
12/// use dsntk_common::gen_id;
13///
14/// assert_eq!(36, gen_id().len());
15/// ```
16/// # References
17///
18/// - [Version 4 UUIDs in RFC4122](https://www.rfc-editor.org/rfc/rfc4122#section-4.4)
19///
20pub fn gen_id() -> String {
21 Uuid::new_v4().to_string()
22}