Skip to content

Complete standard library tables

Reference (complete). Learning path: Stdlib overview. Per-module guides: one file per stdlib module (see Module Index below). Generated name index: reference.md. Signatures source of truth: crates/zz_stdlib/src/funcs.rs.

Available without imports:

Function Signature Description
print print(v: T) -> unit Print value without newline
println println(v: T) -> unit Print value with newline
input input(prompt: str) -> str Read line from stdin (optional prompt)
typeof typeof(v: T) -> str Runtime type name as a string (e.g. "int", "str", "bytes")
str str(v: T) -> str Convert to string (keeps .ok/.some wrappers)
int int(v: T) -> Option<int> Parse/convert to int; .none on failure (use ?? fallback)
float float(v: T) -> Option<float> Parse/convert to float; .none on failure (use ?? fallback)
len len(v: T) -> int Length of array, tuple, bytes, string, dict, or range
range range(stop) / range(start, stop) / range(start, stop, step) Create integer range
map map(arr: [T]|T.., f: func(T)->U) -> [U] Apply function to each element (also std.vec)
filter filter(arr: [T]|T.., f: func(T)->bool) -> [T] Keep elements where predicate is true (also std.vec)
enumerate enumerate(arr: [T]|T..) Index + value pairs (also vec.enumerate / std.vec.enumerate)
zip zip(a: [T]|T.., b: [U]|U..) Pair elements from two iterables
clone clone(v: T) -> T Deep copy, fully independent value
weak weak(v: T) -> T Weak reference for cycle breaking
upgrade upgrade(w: T) -> T Upgrade a weak reference to strong
dbg dbg(v: T) -> T Debug print preserving wrappers, returns v

Namespace rule: globals are convenience aliases. Canonical homes are std.vec.* for array pipelines, str.* for ord/chr. Prefer the canonical home in new code; the bare forms stay until 0.3. int/float return Option — the parse-failure reason is discarded, so fall back explicitly at the call site: int(s) ?? 0. typeof returns a type name string, not a type value — compare with string equality only.

Option/Result methods (method dispatch on variant values) are documented in Built-ins.

One doc file per stdlib module. Each has a purpose paragraph, quickstart example, method-syntax forms, error model, and an exhaustive table of every function/constant/type with signature + description.

Module Purpose Doc
std.str String manipulation, byte offsets String
std.vec Generic array operations Vector
std.bytes Contiguous byte buffers Bytes
std.map Dict helpers: safe lookup, merge Map
std.set Set helpers over arrays Set
std.dec Exact decimal math on strings Decimal
std.json Parse/stringify/get/as_* JSON
std.csv RFC4180 subset CSV
std.property Seeded generators + shrinking Property
std.colors ANSI styling, truecolor, 256-color Colors
std.crypto Digests, HMAC, CSPRNG, passwords, signatures, JWT Crypto
std.encoding Base64, hex, URL codecs Encoding
std.uuid v4/v7 generation, parse, validate UUID
std.log Levels, sinks, spans Log
std.sys Infallible machine info Sys
std.term Raw mode, single-key reads, size Term
std.args Argv + flag parser Args
std.env Environment, cwd, args Env
std.process Run/spawn external processes Process
std.fs Filesystem, providers, streaming FS
std.path Pure lexical path helpers Path
std.http Server + client HTTP
std.net (+ tls/unix) TCP networking Net
std.cell Shared-mutable slots Cell
std.regexp Compiled patterns Regexp
std.sqlz (+ postgres/mysql) SQLite + wire drivers SQL
std.chan Unbounded channels Chan
std.task Spawn and join green threads Task
std.test Asserts, temp dirs, snapshots Test
std.math Numerics, constants Math
std.time Clocks, sleeps, calendar dates Time

TOML is intentionally not in stdlib — use the external pure-ZZ toml package (versioned separately).

println("hello")
print("Enter name: ")
name := input("Enter name: ")
println("Hello, {name}")

print/println unwrap one layer for clean output: .ok(v) prints v, .some(v) prints v, bare .none prints none. Printing a bare .err aborts with a readable hinted error (handle it with match instead), and printing a bare function value is a compile error (cannot print function 'env.os': did you mean 'env.os()'?). Interpolation ("{v}") and str(v) keep the full wrappers.

All fallible ops return Result<_, str> with module:op:code: detail messages, identical on VM and AOT.

import std.fs
match fs.read("data.txt") {
.ok(c) => println(c),
.err(e) => println("read failed: {e}"),
}
// Propagate with `?` inside Result/Option functions:
func load(p: str) -> Result<str, str> {
c := fs.read(p)?
return .ok(c)
}

Bare Result as a statement warns. Handle it (match), propagate (?), or ignore explicitly (_ := ...).