uuid-suffix
Resolve UUIDs by their suffix.
Similar to how git lets you reference commits by a prefix of their hash, this crate lets you reference UUIDs by a suffix. Suffix matching works well for UUID versions with high entropy in their trailing bits (v4, v7), where a 7-character suffix uniquely identifies one UUID among ~268 million with high probability.
Note: UUID v1 and v6 embed a MAC address in the last 48 bits, so UUIDs from the same machine share suffixes. For these, you'll need longer suffixes.
use ;
use Uuid;
let ids: = vec!;
// Find the UUID ending in "6a4e"
let suffix: UuidSuffix = "6a4e".parse.unwrap;
let found = resolve_uuid_suffix.unwrap;
assert_eq!;
// Use matches() for direct comparison
let suffix: UuidSuffix = "eeff".parse.unwrap;
assert!;
// Create a suffix from a UUID for display
println!; // "d3f6a4e"
Features
- serde: Serialization support. Always uses string representation (even in binary formats) because suffixes can be odd-length hex (nibbles can't be losslessly encoded as bytes).
- schemars: JSON Schema support for use with MCP servers and similar.
Related work
If you just want a shorter way to encode UUIDs, short-uuid might fit the bill as well.