Skip to content
You are reading the frozen v0.3.0 documentation. Go to the latest docs.

Standard library overview

Batteries included: HTTP, JSON, fs, math, SQL, crypto, regexp, concurrency. All fallible ops return Result<_, str> with module:op:code: detail messages, identical on VM and AOT.

Module Purpose Doc
built-ins println, len, range, map, int Built-ins
std.str, std.vec, std.bytes strings, arrays, builders Strings and arrays
std.map, std.set, std.dec, std.csv, std.property data helpers Data
std.fs + bytes files, dirs, providers, buffers Filesystem
std.json parse/stringify/get/as_* Data + Filesystem
std.http server + client HTTP
std.net (+ tls/unix) TCP Networking
std.env, std.args, std.process, std.sys, std.log OS integration Env and processes
std.math, std.time numerics, clocks, dates Math and time
std.term, std.colors terminal + ANSI Terminal
std.encoding, std.crypto, std.uuid codecs, hashes, IDs Encoding and crypto
std.regexp compiled patterns Regexp
std.sqlz (+ postgres/mysql) SQLite + wire drivers Databases
std.chan, std.task, std.cell concurrency Concurrency
asserts, std.test tests, temp dirs, snapshots Test helpers
Option/Result methods unwrap, unwrap_or, expect Built-ins

Exhaustive tables: stdlib.md. Signatures source of truth: crates/zz_stdlib/src/funcs.rs.

Globals are convenience aliases. Canonical homes:

  • std.vec.* for array pipelines (vec.* short form works after import std.vec).
  • str.* for ord/chr. Bare ord/chr are aliases.
  • int/float return Option — reason discarded, fall back at the call site: int(s) ?? 0.
  • typeof returns a name string ("int", "bytes") — compare with string equality only.

Prefer canonical homes in new code.

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)?
.ok(c)
}

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