uuid-rs

Crates.iouuid-rs
lib.rsuuid-rs
version0.6.4
sourcesrc
created_at2020-05-27 14:04:46.090341
updated_at2024-11-15 10:44:06.11472
descriptionA Simple Universally Unique IDentifier (UUID)
homepage
repositoryhttps://github.com/ab22593k/uuid-rs
max_upload_size
id246683
size28,362
Abdelwahab (ab22593k)

documentation

https://docs.rs/uuid-rs

README

UUID

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:

Features

  • Generate UUIDs (v4 random)
  • Parse UUID strings
  • Convert UUIDs to bytes and strings
  • Zero-cost abstractions
  • No unsafe code

Usage Examples

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();

Security Considerations

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.

Commit count: 3

cargo fmt