UUID

Constructors

this
this(ubyte[16] uuidData)

Construct a UUID struct from the 16 byte representation of a UUID.

this
this(T uuidData)

Construct a UUID struct from the 16 byte representation of a UUID. Variadic constructor to allow a simpler syntax, see examples. You need to pass exactly 16 ubytes.

this
this(T[] uuid)

<a name="UUID(string)"></a> Parse a UUID from its canonical string form. An UUID in its canonical form looks like this: 8ab3060e-2cba-4f23-b74c-b52db3bdfb46

Members

Enums

Variant
enum Variant

RFC 4122 defines different internal data layouts for UUIDs. These are the UUID formats supported by this module. It's possible to read, compare and use all these Variants, but UUIDs generated by this module will always be in rfc4122 format.

Version
enum Version

RFC 4122 defines different UUID versions. The version shows how a UUID was generated, e.g. a version 4 UUID was generated from a random number, a version 3 UUID from an MD5 hash of a name.

Functions

opAssign
UUID opAssign(UUID s)
opCmp
int opCmp(UUID s)

All of the standard numeric operators are defined for the UUID struct.

opEquals
bool opEquals(UUID s)

All of the standard numeric operators are defined for the UUID struct.

swap
void swap(UUID rhs)

Swap the data of this UUID with the data of rhs.

toHash
size_t toHash()

All of the standard numeric operators are defined for the UUID struct.

toString
void toString(Writer sink)

Write the UUID into sink as an ASCII string in the canonical form, which is 36 characters in the form "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"

toString
string toString()

Return the UUID as a string in the canonical form.

Properties

empty
bool empty [@property getter]

Returns true if and only if the UUID is equal to {00000000-0000-0000-0000-000000000000}

uuidVersion
Version uuidVersion [@property getter]

RFC 4122 defines different UUID versions. The version shows how a UUID was generated, e.g. a version 4 UUID was generated from a random number, a version 3 UUID from an MD5 hash of a name. Returns the version used by this UUID.

variant
Variant variant [@property getter]

RFC 4122 defines different internal data layouts for UUIDs. Returns the format used by this UUID.

Unions

__anonymous
union __anonymous
Undocumented in source.

Examples

UUID id;
assert(id.empty);

id = randomUUID;
assert(!id.empty);

id = UUID(cast(ubyte[16]) [138, 179, 6, 14, 44, 186, 79,
    35, 183, 76, 181, 45, 179, 189, 251, 70]);
assert(id.toString() == "8ab3060e-2cba-4f23-b74c-b52db3bdfb46");

Meta