Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

The Zuri Standard Library

Every module Zuri ships with, and every public name in each one. The pages here are generated from the library’s own doc blocks, so what you read is what the code says.

This is a reference, not a tutorial. It answers “what does this take and what does it return”. For the narrative version, with worked examples and the reasoning behind the design, read The Zuri Programming Language, which cargo run-docs serves alongside this.

How to Read a Page

Every module page opens with the import that reaches it, then the module’s own description, then its members. A package also carries an index of its whole public surface, because a name you reach as os.get_env may well be declared in a file called something else.

Signatures are written the way the source declares them:

  • name: string is a parameter that must be a string, enforced at the call.
  • name: ?string accepts a string or nil, which is how an optional argument is spelled.
  • ...values takes any number of arguments and arrives as a list.
  • -> string is what the call gives back.

A name beginning with an underscore is private: the compiler refuses to import it across a module boundary, so none appear here.

The Modules

Text and Markup

Parsing, building and colouring text meant to be read.

ModuleWhat it is for
htmlA complete HTML5 parser, DOM and serializer, following the WHATWG HTML Living Standard.
wireWire, an HTML template engine.
urlThis module provides classes and functions for parsing, building, resolving and processing URLs (and URL-like identifiers, such…
mimeThis module provides functions that allow easy mime type detection from files.
colorsThis module provides functionalities for color conversion and manipulation.

Data Formats

Reading and writing the formats other programs speak.

ModuleWhat it is for
jsonProvides APIs for encoding and decoding JSON data.
yamlA complete, YAML 1.2.2-compliant library for parsing and emitting YAML (YAML Ain’t Markup Language) documents.
tomlTOML, read for its values or edited in place without disturbing the file around them.
csvA complete, RFC 4180-compliant library for reading and writing Comma-Separated Values (CSV) data.
base64This module provides interface for encoding binary data into strings and decoding such encoded strings back into binary data…
structThis module provides functions for converting between Zuri values and C/C++/Rust structs and vice-versa in the binary format.

Numbers and Collections

Arithmetic, and the containers the built-in types do not cover.

ModuleWhat it is for
mathThis module contains functions and constants to make trigonometric and non-trigonometric mathematics a breeze.
arrayThis module provides fixed-width typed array classes: twos- complement integers (Int8Array/UInt8Array through…
setThis module provides functionalities for working with mathematical sets.

Dates and Times

Calendar arithmetic, formatting, and the timezone database.

ModuleWhat it is for
dateThis modules provides Zuri’s implementation of date and time manipulation methods.

The Machine

The filesystem, other processes, the terminal, the command line, and the configuration around them.

ModuleWhat it is for
osThe os module is Zuri’s interface to the underlying operating system: environment variables, the filesystem, other processes,…
envConfiguration from a file, in the environment, in the type you wanted.
ioThis module provides interfaces for working with to I/O stream and TTYs as well as expose the operating system standard I/O for…
argsThis module provides a complete, batteries-included framework for building command-line interfaces.
logThis module implements a simple and flexible event logging system for all Zuri applications and modules.
statThe module provides constants and functions for interpreting results of file.stat().

Testing

Suites, matchers, test doubles, snapshots, and the reports they produce.

ModuleWhat it is for
testA testing framework: suites, assertions, mocks, snapshots, lifecycle hooks, and reports worth reading.

Networking

Sockets, addresses, and a complete HTTP stack and JSON-RPC on top of them.

ModuleWhat it is for
netThe net module provides networking primitives for Transmission Control Protocol and User Datagram Protocol communication as…
httpA complete HTTP stack: a client, a server, and the pieces both are built from.
rpcJSON-RPC 2.0: calling methods on another program, and answering its calls, over HTTP, WebSockets, sockets, pipes, or any stream…

Security and Identity

Hashing, signing, password storage, tokens and input validation.

ModuleWhat it is for
cryptoComprehensive cryptographic primitives for Zuri applications.
hashThis module provides a framework for cryptographic and non-cryptographic encryption.
bcryptGenerating and verifying bcrypt password hashes, and reading information back out of an existing hash (its cost factor and salt).
jwtThe jwt module provides a complete implementation of JSON Web Tokens (JWT) as defined in RFC 7519, with support for signing,…
uuidProvides RFC 9562 (and RFC 4122) compliant Universally Unique Identifier (UUID) generation, parsing, validation, and inspection.
validateSchema-based input validation for Zuri applications.

Compression and Archives

Every codec and container format the runtime ships with.

ModuleWhat it is for
compressThe compress library provides in-memory and streaming compression and decompression across several algorithms, plus…

Concurrency

Real OS threads, with separate heaps and message passing between them.

ModuleWhat it is for
isolateHigh-throughput parallel concurrency backed by a pool of operating-system isolate threads.

Images

Decoding, drawing, filtering and encoding raster images.

ModuleWhat it is for
imagineReading, writing, drawing and transforming raster images.

Databases

One contract every relational database answers, and the adapters that answer it.

ModuleWhat it is for
sqlOne way to talk to a relational database, whichever one it is.

Mail

Messages, the three protocols that move them, and the servers at the far end.

ModuleWhat it is for
mailMail, from the message to the socket.

Interoperability

Calling C and Rust libraries, being called back by them, and linking static ones.

ModuleWhat it is for
ffiCalling C and Rust libraries, and being called by them.

Types and Conversion

Checked coercion between types, named constants, and conversions between bases and encodings.

ModuleWhat it is for
typesProvides type validation and conversion capabilities
enumThis module provides Zuri’s implementation of enumerations as described in the language documentation: a set of unique values…
convertData conversion between hexadecimal, arbitrary numeric bases, bytes, and decimal numbers.

Metaprogramming

Lexing, parsing and compiling Zuri source, and reflecting on live functions, classes and modules.

ModuleWhat it is for
zuriExposes Zuri’s own compiler pipeline as a library: lexing, parsing, and compiling a Zuri source file, plus a reflect submodule…