View source code
Display the source code in std/uuid.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Struct std.uuid.UUID
struct UUID
;
Constructors
Name | Description |
---|---|
this
(uuidData)
|
Construct a UUID struct from the 16 byte representation of a UUID. |
this
(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
(uuid)
|
Parse a UUID from its canonical string form. An UUID in its canonical form looks like this: 8ab3060e-2cba-4f23-b74c-b52db3bdfb46 |
Fields
Name | Type | Description |
---|---|---|
data
|
ubyte[16] | It is sometimes useful to get or set the 16 bytes of a UUID directly. |
Properties
Name | Type | Description |
---|---|---|
empty [get]
|
bool | Returns true if and only if the UUID is equal to {00000000-0000-0000-0000-000000000000} |
uuidVersion [get]
|
UUID | 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 [get]
|
UUID | RFC 4122 defines different internal data layouts for UUIDs. Returns the format used by this UUID. |
Methods
Name | Description |
---|---|
opAssign
(s)
|
All of the standard numeric operators are defined for the UUID struct. |
opCmp
(s)
|
All of the standard numeric operators are defined for the UUID struct. |
opEquals
(s)
|
All of the standard numeric operators are defined for the UUID struct. |
swap
(rhs)
|
Swap the data of this UUID with the data of rhs. |
toHash
()
|
All of the standard numeric operators are defined for the UUID struct. |
toString
(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
()
|
Return the UUID as a string in the canonical form. |
Enums
Name | Description |
---|---|
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
|
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. |
Example
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]);
writeln(id .toString()); // "8ab3060e-2cba-4f23-b74c-b52db3bdfb46"
Authors
Johannes Pfau
License
Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.