Every version, one type
Time-based, name-based, random and custom identifiers all come back as the
same Uuid. One parser and one set of writers cover every version.
Read any spelling, write the canonical one, and make ids from a name, from a clock, or from a random source. Time comes in as a function and randomness as a moonrand source you pass, so the same code runs on every backend.
moon add moonbitstack/moonuuid{{ error }}
the layout
Every identifier is 128 bits written as five groups. The group sizes never change; what the bits mean depends on the version.
what is here
Time-based, name-based, random and custom identifiers all come back as the
same Uuid. One parser and one set of writers cover every version.
Generator::new takes a clock and a random source. It keeps the
counters, so versions 1 and 6 never repeat and version 7 sorts in the order made.
version, variant, time,
clock_seq and node read the bits back as values, not as a
string you slice.
Canonical, plain hex, braces or urn:uuid:, in any case.
to_string, hex and urn write it back.
A UUID is a JSON string on the way out and any spelling on the way in, with no wrapper type to write.
Malformed points at the character that stopped the parse.
Size gives the two lengths. Nothing fails silently.
start
Ten minutes of guide, or the reference when you know what you are looking for.