[−][src]Function spinoso_securerandom::uuid
pub fn uuid() -> Result<String, RandomBytesError>
Generate a version 4 UUID and return a String
.
A version 4 UUID is randomly generated. See RFC 4122 for details.
Examples
let uuid = spinoso_securerandom::uuid()?; assert_eq!(uuid.len(), 36); assert!(uuid.chars().all(|ch| ch == '-' || ch.is_ascii_hexdigit()));
Errors
If the underlying source of randomness returns an error, return a
RandomBytesError
.