| Crates.io | uuid-rs |
| lib.rs | uuid-rs |
| version | 0.6.4 |
| created_at | 2020-05-27 14:04:46.090341+00 |
| updated_at | 2024-11-15 10:44:06.11472+00 |
| description | A Simple Universally Unique IDentifier (UUID) |
| homepage | |
| repository | https://github.com/ab22593k/uuid-rs |
| max_upload_size | |
| id | 246683 |
| size | 28,362 |
A universally unique identifier (UUID) is a 128-bit number used to identify information in computer systems. When properly generated, UUIDs have an extremely low probability of duplication, making them ideal for distributed systems.
This crate provides a fast and compliant implementation of UUIDs based on:
use uuid_rs::{UUID, v4};
// Generate a random UUID
let id = v4!();
println!("{}", id); // e.g. "67e55044-10b1-426f-9247-bb680e5fe0c8"
// Parse a UUID string
let parsed = UUID::parse("67e55044-10b1-426f-9247-bb680e5fe0c8").unwrap();
assert_eq!(parsed.to_string(), "67e55044-10b1-426f-9247-bb680e5fe0c8");
// Get raw bytes
let bytes = id.as_bytes();
UUIDs should not be used for security purposes or as secret tokens. While UUIDs are unique, they are not cryptographically secure identifiers. For security-sensitive applications, use purpose-built cryptographic primitives instead.