Xo is experimental. The source is now public on GitHub, or try Xo in your browser.
Menu · uuid

Docs

std/uuid

On this page

Index

Types

Uuid

struct Uuid {
  hi: Int
  lo: Int
} derive Ord

A UUID: its 16 bytes as two words. u.display() (or "${u}") is its canonical text, u.bytes() its bytes, u < v the order of its bytes. @internal: use u.bytes() and uuid.from_bytes(b), u.display() and uuid.parse(s), or u < v

Source: std/uuid.xo:12

Uuid.version

fn (u: Uuid) version() -> Int

Source: std/uuid.xo:40

Uuid.bytes

fn (u: Uuid) bytes() -> Bytes

Source: std/uuid.xo:41

Uuid.display

fn (u: Uuid) display() -> Str

Source: std/uuid.xo:42

Uuid.debug

fn (u: Uuid) debug() -> Str

Uuid("<its text>"), as when a Uuid was its text.

Source: std/uuid.xo:44

UuidErr

struct UuidErr {
  msg: Str
}

Displays as google/uuid’s texts: invalid UUID length: 35, invalid UUID format, invalid urn prefix: "urn:uid::".

Source: std/uuid.xo:22

UuidErr.display

fn (e: UuidErr) display() -> Str

Source: std/uuid.xo:26

Functions

v4

fn v4(r: Rand) -> Uuid uses rand

A random UUID (version 4): 122 random bits.

Source: std/uuid.xo:29

v7

fn v7(r: Rand, c: Clock) -> Uuid uses (rand, clock)

A time ordered UUID (version 7): the Unix time in milliseconds, then 74 random bits, so keys made later sort later (to the millisecond).

Source: std/uuid.xo:32

parse

fn parse(s: Str) -> Uuid ! UuidErr

xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx, urn:uuid:…, {…}, or 32 hex digits (google/uuid’s Parse), in either case.

Source: std/uuid.xo:35

from_bytes

fn from_bytes(b: Bytes) -> Uuid ! UuidErr

The 16 bytes.

Source: std/uuid.xo:37

nil

fn nil() -> Uuid

00000000-0000-0000-0000-000000000000.

Source: std/uuid.xo:39

↑ index