uuid+x86_64 +linux

The uuid module implements RFC 9562-compatible Univerally Unique IDentifiers.

This module only generates UUID4, aka "truly random" UUIDs, due to privacy concerns.

Index

Types

type uuid = [16]u8;

Errors

type invalid = !void;

Constants

def UUID_LEN: size = 16;
def UUID_STRLEN: size = 36;
def UUID_URILEN: size = 45;

Globals

const nil: uuid;

Functions

fn compare(a: uuid, b: uuid) bool;
fn decode(in: io::handle) (uuid | invalid | io::error);
fn decodestr(in: str) (uuid | invalid);
fn encode(out: io::handle, in: uuid) (size | io::error);
fn encodestr(in: uuid) str;
fn encodeuri(in: uuid) str;
fn generate() uuid;
fn uri(out: io::handle, in: uuid) (size | io::error);

Types

type uuid[link]

type uuid = [16]u8;

A UUID.

Errors

type invalid[link]

type invalid = !void;

Returned from decode if an invalid UUID is observed.

Constants

def UUID_LEN[link]

def UUID_LEN: size = 16;

The length of a UUID in bytes.

def UUID_STRLEN[link]

def UUID_STRLEN: size = 36;

The length of a UUID in runes when encoded as a string.

def UUID_URILEN[link]

def UUID_URILEN: size = 45;

The length of the return value of uri in runes.

Globals

let nil[link]

const nil: uuid;

The "nil" UUID, with all bits set to zero.

Functions

fn compare[link]

fn compare(a: uuid, b: uuid) bool;

Returns true if two UUIDs are equal.

fn decode[link]

fn decode(in: io::handle) (uuid | invalid | io::error);

Decodes a UUID as a string from an io::handle.

fn decodestr[link]

fn decodestr(in: str) (uuid | invalid);

Decodes a UUID from a string.

fn encode[link]

fn encode(out: io::handle, in: uuid) (size | io::error);

Encodes a UUID as a string and writes it to an I/O handle.

fn encodestr[link]

fn encodestr(in: uuid) str;

Encodes a UUID as a string. The return value is statically allocated, the caller must use strings::dup to extend its lifetime.

fn encodeuri[link]

fn encodeuri(in: uuid) str;

Encodes a UUID as a string. The return value is statically allocated, the caller must use strings::dup to extend its lifetime.

fn generate[link]

fn generate() uuid;

Generates a new version 4 UUID.

fn uri[link]

fn uri(out: io::handle, in: uuid) (size | io::error);

Encodes a UUID as a URI and writes it to an I/O handle.