uuid +linux +x86_64

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

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

Index

Types

type uuid;

Errors

type invalid;

Constants

const UUID_LEN: size;
const UUID_STRLEN: size;
const UUID_URILEN: size;

Globals

let nil: uuid;

Functions

fn compare(uuid, uuid) bool;
fn decode(io::handle) (uuid | invalid | io::error);
fn decodestr(str) (uuid | invalid);
fn encode(io::handle, uuid) (size | io::error);
fn encodestr(uuid) str;
fn encodeuri(uuid) str;
fn generate() uuid;
fn uri(io::handle, 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;

The length of a UUID in bytes.

def UUID_STRLEN[link]

def UUID_STRLEN: size;

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

def UUID_URILEN[link]

def UUID_URILEN: size;

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.