Alpha. Vary is under active development and not ready for production use. Syntax, APIs, performance, and behaviour may change between releases.
UUID
The uuid module generates and validates UUIDs (Universally Unique Identifiers).
from uuid import v4, parse, is_valid
let id = v4() # e.g., "550e8400-e29b-41d4-a716-446655440000"
print(is_valid(id)) # True
print(is_valid("not-a-uuid")) # False
let validated = parse("550e8400-e29b-41d4-a716-446655440000").unwrap()
Functions
| Function | Returns | Description |
|---|---|---|
v4() | Str | Generate a random UUID v4 string |
parse(s) | Result[Str, UuidError] | Parse and validate a UUID string |
is_valid(s) | Bool | Check whether a string is a valid UUID |