The UUID structure provides an implementation of
UUIDs (Universally Unique IDentifiers).
UUIDs, which are also known as GUIDs (Globally Unique IDentifiers),
are sequences of 16-bytes.
Synopsis
structure UUID
Interface
type t
val null : t
val compare : t * t -> order
val same : t * t -> bool
val hash : t -> word
val toString : t -> string
val fromString : string -> t option
val toBytes : t -> Word8Vector.vector
val fromBytes : Word8Vector.vector -> t
Description
type t-
the abstract type of UUIDs.
val null : t-
nullis the all-zeros UUID val compare : t * t -> order-
compare (uuid1, uuid2)does a byte-wise comparison of the two UUIDs and returns their order. val same : t * t -> bool-
same (uuid1, uuid2)does a byte-wise comparison of the two UUIDs and returnstrueis they are equal andfalseotherwise. val hash : t -> word-
hash uuidreturns a hash of the UUID.
val toString : t -> string-
toString uuidformatsuuidas a string of the form
"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
where each "`x`" is a lower-case hexadecimal digit. The first two digits in the string correspond to the first byte, and so on.
val fromString : string -> t option-
fromString sconverts the strings, which should be of the form returned bytoStringtoSOME uuid, whereuuidis the UUID denoted by the string. Leading whitespace is ignored. If the string does not have the correct format, thenNONEis returned. val toBytes : t -> Word8Vector.vector-
toBytes uuidreturns the 16-elementWord8Vector.vectorvalue that representsuuid. val fromBytes : Word8Vector.vector -> t-
fromBytes bytestakes a 16-element vector of bytes and converts it to a UUID. TheSizeexception is raised if the length of the vector is not exactly 16. Otherwise, there is no validity chechking of the UUID (i.e., the variant and type are not checked).