typed-uuid

Id is a typed wrapper around a uuid::Uuid.
Use it to add type safety and prevent confusion between different kinds of Uuid.
Example
Represent different types of Id to prevent mixups or invalid states. If describing
a unique resource's relationship to another, for example the Role a User has,
the relationship can be expressed as follows:
// Subtype the Id type to specify the version of the Id, instead
// of repeating yourself everywhere.
type Id<T> = Id;
Ids with different T parameter types are incompatible, and cannot be compared.
Attempting to assign an Id<User> to a variable of type Id<Role> is a compilation error.
let user = new;
let role = new;
// Compilation fails here, can't compare Id<User> and Id<Role>
assert_eq!;
But Ids of the same type work:
let mut first = new;
let second = new;
first = second;
assert_eq!;
Usage
When depending on this library, you need to explicitly select the versions of the uuid, you will be using, as well as optionally serde support:
[]
= "*"
= false
= ["v4", "serde"]